Implements the component API introduced in Angular 1.5 that solidifies best practice patterns, streamlines APIs, and allows for more performant code to be written through hooks such as $onChanges. Everything in the component API is really just a relatively thin layer on top of existing directive and controller code.
Issue Checklist
[ ] About the reasons behind the introduction of the component API.
[ ] How components can be registered in modules.
[ ] That components are really just directives under the hood.
[ ] How components are restricted so they can only be applied to elements, not attributes or classes.
[ ] That a component always has an isolate scope.
[ ] How component bindings are defined through the bindings object, and that they are always bound to the controller.
[ ] That controller aliasing works for component just like it does for regular directives.
[ ] That component controllers always have an alias, and how it is assigned to $ctrl by default.
[ ] That components may have templates and template URLs.
[ ] That the component template or template URL can be defined using a dependency–injected function.
[ ] How the $element and $attrs injection locals are made available to the component template or template URL function.
[ ] That components support transclusion like regular directives.
[ ] That components support require like regular directives.
[ ] That all component lifecycle hooks also work on regular directives.
[ ] How the ´$onInit´ lifecycle hook works: by being called after the whole element has initialised, before linking.
[ ] How the $onDestroy lifecycle hook works: by tapping into the $destroy event of the scope.
[ ] How the $postLink lifecycle hook works: by being called after called after the element and all children have been linked and all post-link functions have been invoked.
[ ] How the $onChanges lifecycle hook works: by being called with change record when changes occur.
[ ] That the $onChanges hook is first called when the controller bindings are initialized.
[ ] That the change records given to $onChanges are actually instances of a SimpleChange constructor, and have and isFirstChange() method available.
[ ] How $onChanges is invoked in a separate digest after changes have been processed.
[ ] How all the changes from a single digest are batched together using an internal queue inside the compiler.
[ ] How cycles between $onChanges and bindings are protected against with a TTL, which is separate from the scope TTL.
Description
Implements the component API introduced in Angular 1.5 that solidifies best practice patterns, streamlines APIs, and allows for more performant code to be written through hooks such as
$onChanges
. Everything in the component API is really just a relatively thin layer on top of existing directive and controller code.Issue Checklist
bindings
object, and that they are always bound to the controller.$ctrl
by default.$element
and$attrs
injection locals are made available to the component template or template URL function.require
like regular directives.$onDestroy
lifecycle hook works: by tapping into the$destroy
event of the scope.$postLink
lifecycle hook works: by being called after called after the element and all children have been linked and all post-link functions have been invoked.$onChanges
lifecycle hook works: by being called with change record when changes occur.$onChanges
hook is first called when the controller bindings are initialized.$onChanges
are actually instances of aSimpleChange
constructor, and have andisFirstChange()
method available.$onChanges
is invoked in a separate digest after changes have been processed.$onChanges
and bindings are protected against with a TTL, which is separate from the scope TTL.$onChanges
TTL can be configured.All issues in milestone: 0.6.0 milestone
Assignees