Closed
Description
When using the latest UI Router 1.0 Beta version, the following combination of ui-sref and ui-sref-opts results in a non working link an a javascript error.
<a ui-sref="some_state" ui-sref-opts="{inherit:false}">linktext</a>
The "some_state" state is defined in the following way:
$stateProvider.state({
name: 'some_state',
url: '/some_state',
template: '<div></div>'
});
You will get the following error in the JS browser console:
TypeError: Cannot read property '#' of null
at http://run.plnkr.co/jzAWejF0BstomV8D/angular-ui-router.js:3042:83
at Array.map (native)
at Function.Param.values (http://run.plnkr.co/jzAWejF0BstomV8D/angular-ui-router.js:3042:24)
at StateService.href (http://run.plnkr.co/jzAWejF0BstomV8D/angular-ui-router.js:6197:67)
at update (http://run.plnkr.co/jzAWejF0BstomV8D/angular-ui-router.js:7254:40)
at Object.link (http://run.plnkr.co/jzAWejF0BstomV8D/angular-ui-router.js:7267:18)
at https://npmcdn.com/angular@1.5.8/angular.js:1247:18
at invokeLinkFn (https://npmcdn.com/angular@1.5.8/angular.js:9934:9)
at nodeLinkFn (https://npmcdn.com/angular@1.5.8/angular.js:9335:11)
at compositeLinkFn (https://npmcdn.com/angular@1.5.8/angular.js:8620:13) <a ui-sref="other" ui-sref-opts="{inherit:false}">
If I add a parameter to the state like:
$stateProvider.state({
name: 'some_state?param',
url: '/some_state',
template: '<div></div>'
});
and
<a ui-sref="some_state({param: 1})" ui-sref-opts="{inherit:false}">linktext</a>
it works.
Seems like a bug to me.
Here's a Plunkr: http://plnkr.co/edit/yLwDo8waK4H5OKBxbHZA?p=preview