toddmotto / ama

Ask me anything!
20 stars 3 forks source link

angular 1.5 life cycle hook #50

Closed herediadev closed 11 months ago

herediadev commented 8 years ago

Hello Todd, i just have some doubts about the new lifecycle hooks in angular 1.5. i have seen your videos about this new feature, i was reading your post about these hooks, so i forked your jsfiddle, i started playing with the code, and i noticed something, what if the parent component changes some property in the user object?, so i added a new input in the parent component to change the user.name value, and i noticed that the $onChanges lifecycle hook in the child component was not called.

i noticed that if you changes the assignment statement in the updateUser function, and use angular.copy it will trigger the event in the child component This the jsfiddle i forked, if you want to see it

https://jsfiddle.net/herediadev/cs4pL30f/9/

it seems that you have to modify the object a reassign the values, but i don't know, this is my doubts, maybe i did not understand how it works.

Thank you for your time.

PD: sorry about my English