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