Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($compile): Cleanup attribute-binding observers #15298

Closed
wants to merge 5 commits into from
Closed

fix($compile): Cleanup attribute-binding observers #15298

wants to merge 5 commits into from

Conversation

jonathantyates
Copy link
Contributor

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix

What is the current behavior? (You can also link to an open issue here)
#15268

What is the new behavior (if this is a feature change)?
Cleans up attributes observer on change.

Does this PR introduce a breaking change?
No.

Please check if the PR fulfills these requirements

Other information:

Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks good. The testcase doesn't seem to test the new change, though.

Off the top of my head, you can exercise the appropriate path by having a controller that returns an object from its constructor. E.g. something like:

function TestController() {
  return {
    $onChanges: ...
  };
}

TestController.prototype.$onChanges = ...

In thie above case, both $onChanges functions should continue to get called without the fix. With your fix, only the returned one should continue to get called onve the controller is initialized.

var constructorSpy = jasmine.createSpy('constructor');
var prototypeSpy = jasmine.createSpy('prototype');

function TestDirective() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Rename to TestController.

@gkalpak
Copy link
Member

gkalpak commented Oct 20, 2016

LGTM 👍 (I will rename the controller while merging.)

✨ Thx for finding the bug and fixing it too! ✨

@gkalpak gkalpak closed this in 586e2ac Oct 20, 2016
petebacondarwin pushed a commit to petebacondarwin/angular.js that referenced this pull request Nov 21, 2016
petebacondarwin pushed a commit to petebacondarwin/angular.js that referenced this pull request Nov 21, 2016
petebacondarwin pushed a commit to petebacondarwin/angular.js that referenced this pull request Nov 21, 2016
petebacondarwin pushed a commit to petebacondarwin/angular.js that referenced this pull request Nov 21, 2016
petebacondarwin pushed a commit to petebacondarwin/angular.js that referenced this pull request Nov 21, 2016
ellimist pushed a commit to ellimist/angular.js that referenced this pull request Mar 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants