Error injecting angular $location service

67 views Asked by At

I need to use $location service inside my jQuery(callback) function, so I tried to do the following:

$(function(){
    ... some stuff ...
    var $injector = angular.injector(['ng']);
    $injector.invoke(function($location){
        var url = $location.url();
    });
});

but all I get is Uncaught Error: [$injector:unpr] logged in the console. How can I use $location inside my jQuery callback?

0

There are 0 answers