ngMaterial投掷错误:[$ injector:modulerr]

时间:2018-01-26 15:30:51

标签: javascript angularjs angularjs-material angularjs-module angularjs-injector

我正在使用ngMateril进行自定义对话。但我收到错误错误:[$ injector:modulerr]。我无法弄清楚错误。任何帮助将不胜感激。

HTML代码中的外部脚本

    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
(function () {
    'use strict';

    angular
        .module('app', ['ui.router'],['ngMaterial'])
        .config(config)
        .run(run);

    function config($stateProvider, $urlRouterProvider)   {
        // default route
        $urlRouterProvider.otherwise("/");

        $stateProvider
            .state('home', {
                url: '/',
                templateUrl: 'home/index.html',
                controller: 'Home.IndexController',
                controllerAs: 'vm',
                data: { activeTab: 'home' }
            })
            .state('account', {
                url: '/account',
                templateUrl: 'account/index.html',
                controller: 'Account.IndexController',
                controllerAs: 'vm',
                data: { activeTab: 'account' }
            });
    }
 })();
enter image description here

2 个答案:

答案 0 :(得分:1)

您需要稍微改变一下您的模块:

.module('app', ['ui.router', 'ngMaterial'])

答案 1 :(得分:1)

依赖关系顺序应以逗号分隔,

.module('app', ['ui.router', 'ngMaterial'])

您还缺少ng-area和ng-animate的参考文献。请检查以下答案

angular material design ui router not working