-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This was really corner case: Watcher needs to return changed value, to notify that model might have changed and one more $digest cycle needs to be performed. The watcher, that takes care of reference binding into an isolate scope ("="), did not return changed value, if the change was from the isolate scope to the parent. If any other watcher returned change, it worked fine, as this change caused re-digest. Closes angular#1272
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1709,6 +1709,7 @@ describe('$compile', function() { | |
attrAlias: '@attr', | ||
ref: '=', | ||
refAlias: '= ref', | ||
reference: '=', | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
vojtajina
Author
Owner
|
||
expr: '&', | ||
exprAlias: '&expr' | ||
}, | ||
|
@@ -1830,6 +1831,24 @@ describe('$compile', function() { | |
$rootScope.$apply(); | ||
expect(componentScope.ref).toBe('hello misko'); | ||
})); | ||
|
||
// regression | ||
it('should stabilize model', inject(function() { | ||
compile('<div><span my-component reference="name">'); | ||
|
||
var lastRefValueInParent; | ||
$rootScope.$watch('name', function(ref) { | ||
lastRefValueInParent = ref; | ||
}); | ||
|
||
$rootScope.name = 'aaa'; | ||
$rootScope.$apply(); | ||
|
||
componentScope.reference = 'new'; | ||
$rootScope.$apply(); | ||
|
||
expect(lastRefValueInParent).toBe('new'); | ||
})); | ||
}); | ||
|
||
|
||
|
1 comment
on commit a875b0b
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.
otherwise this looks good to me.
you already have
ref
on line 1710, why not use that one?