I have a directive and inside it, I used the $location.url()
but it seems not working, and I think I need to inject something on my app but I don't know where to inject it. By the way I'm new to angularJS.
Here's my code:
app.controller('CVSRRC-CTRL', function($scope,$http,$location){
// some codes here
});
app.directive('cvsrrc', [function(){
return {
restrict: 'A',
link: function(scope, element, attrs){
element.bind('dblclick', function(){
$location.url("admin");
});
}
}
}]);
It doesn't work, but I tried to replace the $location.url("admin");
to alert(1)
It works properly. And when I checked the console it says that $location is undefined
. What should I do ?
ng-dblclick
directive? See AngularJS ng-dblclick Directive API Reference.