I have successfully set up a JSON file containing my ui-routes.
However, I am encountering difficulties when using the Link functionality. I have managed to use it for the following state:
{
"name": "home",
"url": "^/home",
"abstract": false,
"parent": "root",
"views": [{
"name": "container@",
"templateUrl": "/pages/home/index.html",
"controller": "HomeCtrl"
}]
},
To access this state, I use:
<a ui-sref="home">Home</a>
And this is working perfectly fine.
However, I encounter a problem when attempting to use 'ui-sref' with parameters. For example, if trying to navigate to the following state:
{
"name": "approach:module:section",
"url": "^/approach/:module/:section",
"controller": "ApproachCtrl",
"abstract": true,
"parent": "root",
"views": [{
"name": "container@",
"templateUrl": "/pages/approach/overview.html"
}]
}
Based on the documentation and other online resources, I believed the code should be:
<a ui-sref="approach({module: 'overview', section: '1'})">Approach</a>
However, this does not seem to work, as I am encountering the following issue:
Error: Could not resolve 'root.approach' from state 'home'
Can anyone point out where I might be making a mistake in this scenario?
Thank you, Kane