2016-08-27 52 views
0

當我在main.js中添加'ngMaterial', 'ngMessages'時,我的主頁在保存後變爲空白。在檢查空白頁,我能看到下面的庫和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

enter image description here

也試過

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> 

控制檯錯誤: enter image description here

Uncaught Error: [$injector:unpr] Unknown provider: $$asyncCallbackProvider <- $$asyncCallback <- $animate <- $compile 
+1

你不也需要包括角的消息JS固定它? – thepio

+0

@thepio它是角詠歎調的一部分,所以不需要添加 –

+0

噢好吧,不知道:) – thepio

回答

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,並通過更新整個庫