我试图运行一个角度材料的例子,但对于我来说,我无法弄清楚为什么我得到这个错误.
我得到的错误是错误:$inject:modulerr模块错误
任何想法可能是什么问题?我实际上是从他们的示例网站上复制粘贴.
这是代码:
angular.module('MyApp',['ngMaterial','ngMessages','material.svgAssetsCache']) .controller('AppCtrl',function($scope) { });
.buttondemoBasicUsage section { background: #f7f7f7; border-radius: 3px; text-align: center; margin: 1em; position: relative !important; padding-bottom: 10px; } .buttondemoBasicUsage md-content { margin-right: 7px; } .buttondemoBasicUsage section .md-button { margin-top: 16px; margin-bottom: 16px; } .buttondemoBasicUsage .label { position: absolute; bottom: 5px; left: 7px; font-size: 14px; opacity: 0.54; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script> <div ng-controller="AppCtrl" ng-cloak="" class="buttondemoBasicUsage" ng-app="MyApp"> <md-content> <section layout="row" layout-sm="column" layout-align="center center" layout-wrap=""> <md-button class="md-icon-button md-primary" aria-label="Settings"> <md-icon md-font-icon="icon-home"></md-icon> </md-button> <md-button class="md-icon-button md-accent" aria-label="Favorite"> <md-icon md-font-icon="icon-home"></md-icon> </md-button> <md-button class="md-icon-button" aria-label="More"> <md-icon md-font-icon="icon-home"></md-icon> </md-button> <md-button href="http://google.com" title="Launch Google.com in new window" target="_blank" ng-disabled="true" aria-label="Google.com" class="md-icon-button launch"> <md-icon md-font-icon="icon-home"></md-icon> </md-button> <div class="label">Icon Button</div> </section> </md-content> </div> <!-- Copyright 2016 Google Inc. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be in foundin the LICENSE file at http://material.angularjs.org/license. -->
解决方法
您是否参考了与您的角度应用程序相关的.js文件? 我可以看到外部javascript依赖,但与您的应用程序控制器无关.请注意您要导入的顺序