javascript - AngularJS $routeParam vs $location.search(a,b) difference? -


setting url parameter via $routeparams, or setting using $location.search() setter seem achieve same thing, other how parameter appears in url, , in app set.

from app.js config...

$routeprovider    .when('/myroute/:myparam', {}); 

vs.

from controller...

$scope.setlocationparam = function (name, param) {     $location.search(name, param); }; 

i have simple ajax app i'm going step-by-step through few pages , want maintain state in url each subsequent route calling api based on url params set previous route.

when 1 want choose 1 method on other?

i'm leaning towards search param via $location because it's more descriptive thought i'd ask fine people!s


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -