本文介绍了Angular:我一直在注入器 modulerr 上收到此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个有角度的应用程序,但它不断出现此错误:

I am making an angular app and it keeps giving this error:

未捕获的错误:[$injector:modulerr] http://errors.angularjs.org/1.4.9/$injector/modulerr?p0=webinarApp&p1=Error…0c%20(https%3A%2F%2Fcode.angularjs.org%2F1.4.9%2Fangular.min.js%3A19%3A463)

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.9/$injector/modulerr?p0=webinarApp&p1=Error…0c%20(https%3A%2F%2Fcode.angularjs.org%2F1.4.9%2Fangular.min.js%3A19%3A463)

我已经包含了 ngRoute 模块的 cdn,app.module 中的 ngRoute,定义了一个新的 $route 提供程序,包括 ng-view,

I have included the cdn for ngRoute module, ngRoute in app.module, defined a new $route provider, included ng-view,

这是我的代码:

App.js

var webinarApp = angular.module('webinarApp', ['ngCookies', 'ngRoute']);

webinarApp.config(function($routeprovider){
    $routeprovider

    .when('/', {
      templateUrl: './home.html',
      controller: 'mainController'
    })
    .when('/signup', {
      templateUrl: './signup.html',
      controller: 'mainController'

    })
});

webinarApp.controller('mainController', ['$scope', '$http', '$cookies', function($scope, $http, $cookies){

  $scope.welcomeMessage = 'Hello from Angular';
  $scope.users = [];
  $scope.searchQuery = "";
  $scope.orderByField = 'name';
  $scope.newUser = {};
  $scope.logInUser = {};
  $scope.webinars = [];
  $scope.newWebinar = {};
  $scope.isDisabled = false;


  // ============== Users ================

Index.html

<!DOCTYPE html>
<html lang="en" ng-app="webinarApp">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Find a Webinar</title>






    <!-- Custom CSS -->
    <link href="css/grayscale.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/signin.css" rel="stylesheet">



    <script src="//code.angularjs.org/1.4.9/angular.min.js"></script>
    <script src="//code.angularjs.org/1.4.9/angular-route.min.js"></script>

</head>

<body ng-controller="mainController" id="page-top" data-spy="scroll" data-target=".navbar-fixed-top">


<div class="container" ng-view></div>

</body>

</html>

推荐答案

您拼错了服务名称:

$routeprovider

应该是

$routeProvider

这篇关于Angular:我一直在注入器 modulerr 上收到此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 11:21