Skip to content
This repository has been archived by the owner on Sep 20, 2020. It is now read-only.

sticky - "updateStateParams" transition when pass object param between states #251

Closed
dmaciaszek opened this issue Oct 9, 2015 · 6 comments

Comments

@dmaciaszek
Copy link

Hi,
I have some problem with sticky mode in my app. I have many states based in tab elements. I want to save every view when I switch between tabs, but if I come back to some tab, state is not 'reactivate' but is 'updateStateParams'. Between states a pass by params some Object like { name: 'someName', age : 20, active : true}. When I switch between tabs I do not change anything in my params object. I discovered that in your sticky script stateParams are compared with inactiveState params. In my case compared objects are the same but in my opinion comparision method is wrong. It is some lines in sticky script (line 139):

if (!angular.equals(a[k], b[k])) return false; // Not '===', values aren't necessarily normalized

As I wrote I pass in params OBJECT not primitive. This code compare values only for primitives. For object I think should use e.g. angular.equals method. My object are equal but this script think that is not so return false what couses 'updateStateParams' transition (I think it is wrong because a do not change my params object).

So my question is...It is a bug or it is intentional to compare reference to object not value?

@christopherthielen
Copy link
Owner

I think this is a dupe of #239 and it is fixed in 0.0.15-pre2. Can you try the version found in the plunk for issue 239 and let me know if it works for you?

@dmaciaszek
Copy link
Author

Thank you for quick reply and link.

@christopherthielen
Copy link
Owner

let me know if it works for you

@dmaciaszek
Copy link
Author

Ok I will let you know next week. Thanks.

@dmaciaszek
Copy link
Author

It is working fine. Thanks again.

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

No branches or pull requests

2 participants