-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($parse): stateful interceptors override an undefined
expression
#9825
Conversation
@rodyhaddad WDYT? |
12b1c69
to
3a3bc81
Compare
|
||
inject(function($rootScope) { | ||
compile('<div ng-controller="controllerWithWatch">' + | ||
'<p>{{text}}</p>' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong, should be {{greeting}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a watcher on the parent scope that will copy greeting
to text
that is not triggered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of the watcher in the parent scope, that is bogus and unrelated to the issue, honestly. The problem still happens when the 2-way binding name is used. That's bad.
When using `$parse` with a stateful interceptor and the expression is `undefined`, then return the result from the interceptor Closes angular#9821
updated the patch with the comments |
yeah --- so I mean this is okay, but it's weird that we're special-casing |
and |
@tbosch / @jeffbcross what do you think --- leave it as is, or find a way to isolate the bogus behaviour to just bind-once delegates? |
the other option would be to add another property to the interceptor to state this interceptor overrides an |
I don't see why we'd want to do that --- the behaviour was added for bind-once, that's where it makes sense. Why add another footgun for people to use? |
@IgorMinar did you ever take a look at this? As I said, I think we could land it and fix it up later, but I would prefer we didn't do it in this fashion |
I'm not keen on having another flag. I'm with @caitp that something smells here. As @caitp suggested the change above should be the default behavior, but that requires some changes to one-time binding and The fix above shouldn't cause other issues AFAICT, so let's land it now and improve next week. |
sounds good to me |
When using
$parse
with a stateful interceptor and the expression isundefined
, then return the result from the interceptorCloses #9821