angularjs - ui router dynamic URL issue - url: '/:id/page1' not working -


how create dynamic route when using ui router,

if define:

$stateprovider.state('page1', {       url: '/page1/:id',       views:{} } 

it works fine,

but if try add dynamic id first , page name gives error,

error:

$stateprovider.state('page1', {       url: '/:id/page1',       views:{} } 

how resolve issue, can me this?

ok based on comment should use this:

$stateprovider   .state('page1', {   url: '/:id/page1' }); 

the part above fine. in link should use this:

<a ui-sref="page1({id: '1234'})">page1</a> 

you can set variable ui-sref like:

<a ui-sref="page1({id: page.id})">page1</a> 

Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -