angularjs - How to prevent an ui-router parameter override? -


i'm working on site multiple sub-routes, , i'd create simple url user profiles, example:

mydomain.com/someusername 

but current ui-router state configuration, overrides of other urls, guess because considers other routes parameter too.

.state('profile', {   url: '/{username}',   template: '...',   controller: '...', }) .state('other', {   url: '/other',   template: '...',   controller: '...', }); 

(like in example, 'other' state considered parameter in profile state)

i've tried subclassing root state, didn't worked either. can around problem using keyword in front of usernames (eg: mydomain.com/user/someusername), that's bit more complicated user experience viewpoint.

is there way i'm trying to?

the order of state definition important.. switch them

// more specific .state('other', {   url: '/other',   template: '...',   controller: '...', }) // more general .state('profile', {   url: '/{username}',   template: '...',   controller: '...', }) 

ui-router adding states queue , later iterates find match. if general last.. more specific found properly


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -