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

State param not passed by reference when using ui-sref? #3310

Closed
cadilhac opened this issue Jan 31, 2017 · 2 comments
Closed

State param not passed by reference when using ui-sref? #3310

cadilhac opened this issue Jan 31, 2017 · 2 comments
Milestone

Comments

@cadilhac
Copy link

Hi,

I am used, when using angular 1.5 components, to be able to modify a property of a one-way binding in a child component and get the value also modified in the parent since the binding is passed by reference. So I was expecting the same when passing an object as the param of a target state.

<a ng-repeat="game in $ctrl.games" ui-sref="myState({ game: game})">Go</a>

Unfortunately, when I modify a property of game in the controller of MyState, it doesn't change it in parts of the page that also reference the game object. Is it possible that the object is cloned when passed as a param?

Thanks

@vladimiry
Copy link

vladimiry commented Feb 22, 2017

I'm using 1.0.0-rc.1 version and AngularJS 1.5.11. I pass promise instance as a parameter. I then take this parameter in the corresponding component, but no promise resolving happens. The probable reason looks for me like - the specified parameters are not passed by the reference.

<a href ui-sref="directorySaved({findSavedItemsPromise: $ctrlDirectory.$s.findSavedItemsPromise})">
    Saved profiles
</a>
        .state('directorySaved', {
            url: '/directory/saved',
            params: {
                findSavedAlumniPromise: null
            },
            views: {
                header: headerComponent.$name,
                content: directorySavedComponent.$name
            }
        })

@christopherthielen christopherthielen added this to the 1.0.0-rc.2 milestone Mar 14, 2017
@christopherthielen
Copy link
Contributor

Thanks for the report.
I believe this will be fixed by #3330

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

No branches or pull requests

3 participants