Is any way how to access $route
inside directive function?
What I basically want is to know the current templateUrl
, say:
app.directive("scrollable", function ($document) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
$document.bind('scroll', function (evt) {
console.log($route.current.templateUrl); // $route is undefined!
});
}
};
});
P.S. I am newbie in the AngularJS, don't be so rigorous :)