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

fix($compile): do not use noop() as controller for multiple components #14402

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Apr 9, 2016

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)
#14391

What is the new behavior (if this is a feature change)?
A new function is used as controller for each component that does not specify one.

Does this PR introduce a breaking change?
No

Please check if the PR fulfills these requirements

Other information:
Currently, custom annotations are copied from the CDO onto the controller constructor.
Using noop() when no controller has been specified, pollutes it with custom annotations and makes one component's annotations available to all other components that have noop() as their controller.

Fixes #14391

Currently, custom annotations are copied from the CDO onto the controller constructor.
Using `noop()` when no controller has been specified, pollutes it with custom annotations and
makes one component's annotations available to all other components that have `noop()` as their
controller.

Fixes angular#14391
module('my', []).
component('myComponent1', {$customAnnotation1: 'XXX'}).
component('myComponent2', {$customAnnotation2: 'YYY'});
module('my');
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be a newline before and after this line for readability.

@Narretz
Copy link
Contributor

Narretz commented Apr 11, 2016

LGTM, apart from a nitpick

petebacondarwin pushed a commit that referenced this pull request Apr 11, 2016
Currently, custom annotations are copied from the CDO onto the controller constructor.
Using `noop()` when no controller has been specified, pollutes it with custom annotations and
makes one component's annotations available to all other components that have `noop()` as their
controller.

Fixes #14391
Closes #14402
@gkalpak gkalpak deleted the fix-compile-registerComponent-pollutes-noop branch April 14, 2016 20:15
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.

Potential bug in registerComponent
3 participants