I have a simple code:
define(['app'], function(app)
{
app.factory('factoryProvider', function(){
return {
name: 'my Name'
}
});
app.directive('myDiv',['factoryProvider', function(factoryProvider) {
return {
restrict: 'E',
replace: true,
templateUrl: 'link/to/template.html',
controller: function($scope) {
},
link: function(scope, routeParams, location) {
console.log(factoryProvider.name);
}
};
}])
});
I want to be able to access myFactorywithin the link function, but I can't! I also tried link: function(scope, routeParams, location, factoryProvider) and that also didn't work. Why?