angularJS,“[$ injector:modulerr]”

时间:2016-05-05 14:00:06

标签: angularjs

为什么我会出现注射错误?

https://jsfiddle.net/pvaq1ywh/

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js"></script>
<div ng-app="myApp">
  <div ng-controller="Controller">
    {{greeting}}
  </div>
</div>

JS

var myApp = angular.module('myApp',["firebase"]);

myApp.controller('Controller', ['$scope', function($scope) {
  $scope.greeting = 'Hola!';
}]);

1 个答案:

答案 0 :(得分:1)

在JS窗格中,单击“设置”,然后将加载类型设置为No wrap - in <body>

它可能无法正常工作,因为脚本是在加载依赖项之前执行的。