角度教程。错误:[$ injector:modulerr]无法实例化模块MailboxApp

时间:2016-08-20 16:21:18

标签: javascript angular-ui-router

我是棱角分明的新人。继教程之后,我很遗憾地遇到了第1步。 以下是我的代码。它似乎简单但不确定如何解决它。 谢谢你的帮助!

的index.html

<head>
    <script src=bower_components/angular/angular.js></script>
    <script src=bower_components/angular-ui-router/release/angular-ui-router.js></script>
    <script src=main.js></script>
</head>
<body ng-app="MailboxApp">
    <div ui-view></div>
</body>

main.js

angular.module("MailboxApp", ['ui.router'])
.config(function($stateProvider, $urlRouterProvider){
    $urlRouterProvider.otherwise("/inbox");
    $stateProvider.state("inbox", {
        url:"/inbox",
        templateUrl:"partials/inbox.html",
        controller:function (){
            console.log("Inbox.")
        }
    })
})

我收到以下错误:

angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module MailboxApp due to:
Error: [$injector:modulerr] Failed to instantiate module angular.ui.router due to:
Error: [$injector:nomod] Module 'angular.ui.router' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.8/$injector/nomod?p0=angular.ui.router
    at http://127.0.0.1:8080/bower_components/angular/angular.js:68:12
    at http://127.0.0.1:8080/bower_components/angular/angular.js:2082:17
    at ensure (http://127.0.0.1:8080/bower_components/angular/angular.js:2006:38)
    at module (http://127.0.0.1:8080/bower_components/angular/angular.js:2080:14)
    at http://127.0.0.1:8080/bower_components/angular/angular.js:4617:22
    at forEach (http://127.0.0.1:8080/bower_components/angular/angular.js:321:20)
    at loadModules (http://127.0.0.1:8080/bower_components/angular/angular.js:4601:5)
    at http://127.0.0.1:8080/bower_components/angular/angular.js:4618:40
    at forEach (http://127.0.0.1:8080/bower_components/angular/angular.js:321:20)
    at loadModules     (http://127.0.0.1:8080/bower_components/angular/angular.js:4601:5)
http://errors.angularjs.org/1.5.8/$injector/modulerr?p0=angular.ui.router&p…2F%2F127.0.0.1%3A8080%2Fbower_components%2Fangular%2Fangular.js%3A4601%3A5)
at http://127.0.0.1:8080/bower_components/angular/angular.js:68:12
at http://127.0.0.1:8080/bower_components/angular/angular.js:4640:15
at forEach (http://127.0.0.1:8080/bower_components/angular/angular.js:321:20)
at loadModules (http://127.0.0.1:8080/bower_components/angular/angular.js:4601:5)
at http://127.0.0.1:8080/bower_components/angular/angular.js:4618:40
at forEach (http://127.0.0.1:8080/bower_components/angular/angular.js:321:20)
at loadModules (http://127.0.0.1:8080/bower_components/angular/angular.js:4601:5)
at createInjector (http://127.0.0.1:8080/bower_components/angular/angular.js:4523:19)
at doBootstrap (http://127.0.0.1:8080/bower_components/angular/angular.js:1758:20)
at bootstrap (http://127.0.0.1:8080/bower_components/angular/angular.js:1779:12)
http://errors.angularjs.org/1.5.8/$injector/modulerr?p0=MailboxApp&p1=Error…F%2F127.0.0.1%3A8080%2Fbower_components%2Fangular%2Fangular.js%3A1779%3A12)

0 个答案:

没有答案