javascript 带有 angularJS 应用程序的角度材料

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28424805/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 08:57:44  来源:igfitidea点击:

Angular material with angularJS application

javascripthtmlangularjsmaterial-designangular-material

提问by Sajeetharan

I am planing to implement angular material design with my application. i have included the material.js and material.css and the app definition goes as follows, here is the code,

我计划在我的应用程序中实现有角度的材料设计。我已经包含了 material.js 和 material.css 并且应用程序定义如下,这是代码,

Index.html:

索引.html:

 <script src="js/ripples.js"></script>
 <script src="js/material.js"></script>

app.jsar routerApp = angular.module('DiginRt', ['ui.bootstrap','SimpleCouch','ngMaterial']);

app.jsar routerApp = angular.module('DiginRt', ['ui.bootstrap','SimpleCouch','ngMaterial']);

When i start to run the application, it says

当我开始运行应用程序时,它说

 Uncaught Error: [$injector:modulerr] Failed to instantiate module DiginRt 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.

回答by dsteve

I have created my angular material design project using this sequential injection, hope it helps,

我已经使用这种顺序注入创建了我的角度材料设计项目,希望它有所帮助,

  <script src="bower_components/angular/angular.js"></script>
  <script src="bower_components/angular-animate/angular-animate.js"></script>
  <script src="bower_components/angular-route/angular-route.js"></script>

  <script src="bower_components/angular-aria/angular-aria.js"></script>
  <script src="bower_components/hammerjs/hammer.js"></script>
  <script src="bower_components/angular-material/angular-material.js"></script>
...  
  <script src="app.js"></script>

Btw, did you install it using bower install angular-material --save?

顺便说一句,您是否使用 bower install angular-material --save 安装它?

回答by colefner

The error is saying that it cannot find a dependency. It's likely you included your scripts in the wrong order. Make sure the app.js is included last. Without seeing a code example I cannot be any more specific than that. As @rebornix said, a jsfiddle or Plunker would be very helpful.

错误是说它找不到依赖项。您很可能以错误的顺序包含脚本。确保最后包含 app.js。在没有看到代码示例的情况下,我不能比这更具体了。正如@rebornix 所说,jsfiddle 或 Plunker 会非常有帮助。