I am asking this question because I am not quite clear on how to think of rootscope as a dependency passed to directives
I have a directive that needs to display some in
Another way is to create a service and throw that service access the $rootScope and other functions. I did it like this because of my environment...
app.service('myService', function ($rootScope)
{
this.removeItem = function (el)
{
console.log('rootScope: ',$rootScope);
return true;
}
});
app.directive('draggable', function($document,myService)
{
return function(scope, element, attr)
{
myService.removeItem({id:1})
}
});
If you can, the best way is Mike solution. if not, try my solution.