Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0 Beta: ui-sref-opts="{inherit:false}" breaks ui-sref="some_state" with no parameters #2952

Closed
derzwen opened this issue Aug 29, 2016 · 1 comment

Comments

@derzwen
Copy link

derzwen commented Aug 29, 2016

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/[email protected]/angular.js:1247:18
    at invokeLinkFn (https://npmcdn.com/[email protected]/angular.js:9934:9)
    at nodeLinkFn (https://npmcdn.com/[email protected]/angular.js:9335:11)
    at compositeLinkFn (https://npmcdn.com/[email protected]/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

@eddiemonge eddiemonge added the 1.0 label Aug 29, 2016
@christopherthielen christopherthielen added this to the 1.0.0-beta.2 milestone Aug 30, 2016
@christopherthielen
Copy link
Contributor

Thanks. targeting beta.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants