我正在尝试将服务注入如下指令:
var app = angular.module('app',[]);
app.factory('myData', function(){
return {
name : "myName"
}
});
app.directive('changeIt',function($compile, myData){
return {
restrict: 'C',
link: function (scope, element, attrs) {
scope.name = myData.name;
}
}
});
但这是给我一个错误Unknown provider: myDataProvider
。有人可以查看代码并告诉我我是否做错了什么?