当我在'ngMaterial', 'ngMessages'
中添加main.js
时,我的主页在保存后加载时变为空白。在检查空白页面时,我能够看到以给定顺序正确加载的以下libs和css
的index.html
<link href="assets/css/angular-material.min.css" rel="stylesheet">
<script src="assets/js/lib/angular.min.js"></script>
<script src="assets/js/lib/angular-route.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-messages/1.5.8/angular-messages.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.js"></script>
<script src="https://gitcdn.link/repo/angular/bower-material/master/angular-material.js"></script>
还尝试了CDN
main.js
var app = angular.module( indexModuleName , [
'ngRoute', 'ngMaterial', 'ngMessages'
]);
controller.js
app.controller('searchCtrl', function($scope){
$scope.user = {
search: '',
};
});
已应用html
<md-input-container class="md-block" ng-controller="searchCtrl" >
<input ng-model="user.search" placeholder="Search" ng-required="true">
</md-input-container>
Uncaught Error: [$injector:unpr] Unknown provider: $$asyncCallbackProvider <- $$asyncCallback <- $animate <- $compile
答案 0 :(得分:0)
最终版本不匹配,
<script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.js"></script>
早些时候是,
<script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.js"></script>
通过添加bower.json
并通过更新整个库来修复它