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
Post a Comment