[英]Angular JS Module Injecting Error
最近,我一直在使用angular JS,它很棒。 但是,我不是很了解内在的注入。 我几乎在每个页面上都使用了这种模式,并且可以正常工作。
var workoutApp = angular.module('workoutApp', []);
workoutApp.controller('workoutControllers', ['$scope', '$http', '$window', function ($scope, $http, $window) {
//do something with $scope.
现在我想使用ngMaterial http://codepen.io/anon/pen/VeNqYB实现自动完成
语法与我一直在做的完全不同,所以我很困惑。 我试图以这种方式注入模块,
var workoutApp = angular.module('workoutApp', ['ngMaterial', 'ngMessages', 'material.svgAssetsCache']);
但不断出错。 任何人都可以对此发表一些想法吗?
根据文档,ngMaterial不仅仅依赖于角度。
在CDN示例( https://github.com/angular/material#cdn )中,您可以看到依赖关系。
<!-- Angular Material Dependencies -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.js"></script>
听起来像修复程序像添加这些依赖项一样简单。
即使我使用的是Angular版本1.3.0,也安装了Angular Material,“无法实例化模块ngMaterial”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.