本文介绍了未捕获的错误:[$喷油器:modulerr] http://errors.angularjs.org/1.4.3/$injector/modulerr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是错误消息我得到了code我写。我不得不提到的错误消息后,code。我是新的,需要帮助!

<script src="Lib/angular.min.js" type="text/javascript"></script>
        <script src="Lib/angular-route.js" type="text/javascript"></script>
        <script>
            var demoApp=angular.module('mainApp',[ngRoute]);

            demoApp.config(function($routeProvider){
                $routeProvider
                        .when('/',
                {
                    controller:'SimpleController',
                    templateUrl:'view1.html'
                })
                        .when('/view1',{
                            controller:'SimpleController',
                            templateUrl:'/view.html'
                })
                        .otherwise({redirectTo:'/'});
            });

            demoApp.controller('SimpleController',function($scope){
            $scope.customers=[
            {name:'Joe',city:'Toronto'},
            {name:'Jane',city:'Sydney'},
            {name:'Roberto',city:'Vienna'},
            {name:'Kumiko',city:'Japan'}
           ];

           $scope.addCustomer=funtion(){
             $scope.customers.push({name:$scope.newCustomer.name,city:$scope.newCustomer.city});  
           };
        });/*
            function SimpleController($scope){
                $scope.customers=[
                    {name:'Sabin',city:'Bhaktapur'},
                    {name:'Abhi',city:'Lalitpur'},
                    {name:'shree',city:'Kathmandu'},
                    {name:'rameshwor',city:'Bhojpur'}
                   ];
            }*/
        </script>
解决方案

ngRoute should be in quotes:

var demoApp=angular.module('mainApp',['ngRoute']);

这篇关于未捕获的错误:[$喷油器:modulerr] http://errors.angularjs.org/1.4.3/$injector/modulerr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 18:07