Friday 15 January 2010

angularjs - How to use a different routeProvider depending on a section of your site -



angularjs - How to use a different routeProvider depending on a section of your site -

suppose have multiple sections on site, depending on someones role.

/customer /manager /administrator

i wonder how set angular routes url's possible:

/customer /customer#/account /customer#/mybasket /manager /manager#/account /manager#/orders /administrator /administrator#accounts /administrator#settings

the "when" status of $routeprovider check on url after hash sign. how can first reroute based on first part of url? or how map unique routeprovider per url (/customer, /manager, /administrator) ?

the alternative have utilize html5mode=true , rid of # altogether. requires handling total page refresh in case server need homecoming right html.

this $location developer guide

server side

using mode requires url rewriting on server side, have rewrite links entry point of application (e.g. index.html). requiring tag of import case, allows angular differentiate between part of url application base of operations , path should handeled application.

angularjs angular-routing

No comments:

Post a Comment