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

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -