AngularJS和材料设计:无法实例化模块ngMaterial

时间:2018-06-19 15:05:11

标签: javascript angularjs material-design angularjs-material

我尝试启动已经开发的应用程序。 它必须可以工作,但是在浏览器上测试我的应用程序时出现错误。

Error: [$injector:modulerr] Failed to instantiate module xxxApp due to:
Error: [$injector:modulerr] Failed to instantiate module ngMaterial due to:
Error: [$injector:nomod] Module 'ngMaterial' 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.

bower.json

{
  "name": "xxx",
  "version": "0.0.0",
  "dependencies": {
    "angular": "1.5.8",
    "bootstrap": "~3.3.6",
    "angular-animate": "1.5.8",
    "angular-cookies": "1.5.8",
    "angular-resource": "1.5.8",
    "angular-route": "1.5.8",
    "angular-sanitize": "1.5.8",
    "angular-translate": "2.13.0",
    "angular-translate-loader-static-files": "2.13.0",
    "ng-focus-if": "~1.0.4",
    "angular-material": "^1.0.4",
    "angular-virtual-keyboard": "0.4.3",
    "angular-translate-storage-cookie": "2.13.0"
  },
  "devDependencies": {
    "angular-mocks": "1.5.8"
  },
  "appPath": "app",
  "moduleName": "xxxApp",
  "overrides": {
    "bootstrap": {
      "main": [
        "less/bootstrap.less",
        "dist/css/bootstrap.css",
        "dist/js/bootstrap.js"
      ]
    }
  }
}

index.html

<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-translate/angular-translate.js"></script>
<script src="bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js"></script>
<script src="bower_components/ng-focus-if/focusIf.js"></script>
<script src="bower_components/angular-aria/angular-aria.js"></script>
<script src="bower_components/angular-messages/angular-messages.js"></script>
<script src="bower_components/angular-material/angular-material.js"></script>
<script src="bower_components/angular-virtual-keyboard/release/angular-virtual-keyboard.min.js"></script>
<script src="bower_components/angular-translate-storage-cookie/angular-translate-storage-cookie.js"></script>

[EDIT1] 应用程序的主要模块

angular
    .module('pisApp', [
        'ngAnimate',
        'ngCookies',
        'ngResource',
        'ngRoute',
        'ngSanitize',
        'pascalprecht.translate',
        'ngMaterial',
        'angular-virtual-keyboard',
        'ngMessages',
        'focus-if'
    ])

[/ EDIT1]

[EDIT2] Bower安装后安装的依赖项列表

bower install       angular#1.5.8
bower install       angular-translate#2.13.0
bower install       ng-focus-if#1.0.7
bower install       angular-resource#1.5.8
bower install       angular-cookies#1.5.8
bower install       angular-animate#1.5.8
bower install       angular-translate-loader-static-files#2.13.0
bower install       angular-virtual-keyboard#0.4.3
bower install       angular-translate-storage-cookie#2.13.0
bower install       angular-route#1.5.8
bower install       angular-sanitize#1.5.8
bower install       angular-material#1.1.9
bower install       angular-mocks#1.5.8
bower install       angular-aria#1.7.2
bower install       angular-messages#1.7.2
bower install       bootstrap#3.3.7
bower install       jquery#3.3.1

[/ EDIT2]

我运行“ npm install”,“ bower install”和“ grunt”没有错误

谢谢您的帮助

0 个答案:

没有答案