无法在页面中看到Angular实现

时间:2016-08-27 09:17:05

标签: javascript angularjs angular-material

当我在'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

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 个答案:

答案 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并通过更新整个库来修复它