Please do not use $ parent!
Use the correct prototype inheritance.
The reason it doesn't work is because you are creating a new area using ngIf .
It does not create a selection area, so you do not need to worry about it.
When you pass primitive , Javascript will "obscure" this value on the prototype of the new scope.
Thus, it is no longer a direct reference to a value in your parent area.
How do you get around this?
This is roughly equivalent; use an object and bind to the property of this object. objects do not get shadows because they are not primitive. you can save the link and it just works ™.
jsfiddle
source share