javascript - AngularJs. $location service. Url modification -


suppose, have follwing code angularjs:

 angular.module('somename', []).          config(function ($routeprovider, $locationprovider) {                 $routeprovider.                 when('/test/:userid', { controller: testdatactrl }).                 when('/users/:userid', {controller: userdatactrl}).                 otherwise({redirectto: '/index.html'});                 $location.path('/newvalue')                 }); 

but fragment throws referenceerror: $location not defined archivarius. ok, no problem. added third parameter $location function , got error -- unknown provider: $location archivarius.

so, how can instance of $location service?

in other words, have ugly url like:

http://localhost:7000/myservice/1?html=true#/index 

and routes above doesn't work, because supposed service url looks like

http://localhost:7000/myservice/#/index              or http://localhost:7000/myservice/index 

but because of internal redirect logic of rest service came little bit confusing url angularjs , need change without page reload.

thanks in advance.

add `$location' object config unanimous function:

config(function ($routeprovider, $locationprovider, $location)  

hope helps


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -