javascript - AngularJS UI Router -> Could not resolve when using ui-sref -
i have setup json file ui-routes in , works.
but having trouble using link. have manged use when comes using following state:
{ "name": "home", "url": "^/home", "abstract": false, "parent": "root", "views": [{ "name": "container@", "templateurl": "/pages/home/index.html", "controller": "homectrl" }] },
to access use:
<a ui-sref="home">home</a>
and works perfectly.
but problem comes when try , 'ui-sref' parameters. example if , state:
{ "name": "approach:module:section", "url": "^/approach/:module/:section", "controller": "approachctrl", "abstract": true, "parent": "root", "views": [{ "name": "container@", "templateurl": "/pages/approach/overview.html" }] }
from reading documentation , other online tutorials thought code should be:
<a ui-sref="approach({module: 'overview', section: '1'})">approach</a>
this doesn't seem work. seem following issue:
error: not resolve 'root.approach' state 'home'
where going wrong this?
thanks, kane
i not sure think ui-router trying find root.approach not find maybe have named state approach:module:section. try renaming state approach
Comments
Post a Comment