仍然找到我的方式與角度,我得到「未捕獲的ReferenceError:y沒有定義」的行「.directive('y',[y,function(y){ 「這就像它沒有加載該服務。我也試圖從BOD移動腳本的頭部,但沒有做到。Angularjs Uncaught ReferenceError注入服務指令
angular.module('fofApp', ['appRoutes'])
.factory('y',['$rootscope',function($rootScope) {
return {val: "he"};
}])
.directive('yow',[y,function(y){
return {
restrict: "E",
template: "<h1>aaaaah</h1>"
};
}]);
我的HTML是
<!doctype html>
<html>
<head>
</head>
<body ng-app="fofApp">
<yow></yow>
<script src="libs/angular/angular.js"></script>
<script src="js/app.js"></script>
</body>
</html>
看來是這樣的話。 – cclusetti 2014-09-30 21:54:31