Package org.angular.ts.ng
Interface Controller
@JsType(isNative=true,
name="ng.Controller",
namespace="<global>")
public interface Controller
AngularTS component lifecycle interface. Directive controllers have a well-defined lifecycle. Each controller can implement "lifecycle hooks". These are methods that will be called by Angular at certain points in the life cycle of the directive. https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks https://docs.angularjs.org/guide/component
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceTypeScript callback contract for this property.static interfaceTypeScript callback contract for this property.static interfaceTypeScript callback contract for this property.static interfaceTypeScript callback contract for this property.static interfaceTypeScript callback contract for this property. -
Method Summary
Modifier and TypeMethodDescriptionstatic Controllercreate()Called after this controller has been linked, AngularTS has applied DOM mutations for the current flush, and the browser has had one animation frame to settle layout.getName()Optional controller name (used in debugging)Called whenever one-way bindings are updated.Called on a controller when its containing scope is destroyed.Called on each controller after all the controllers on an element have been constructed and had their bindings initialized (and before the pre & post linking functions for the directives on this element).Called after this controller's element and its children have been linked.voidsetAfterRender(Controller.AfterRenderCallback afterRender) Called after this controller has been linked, AngularTS has applied DOM mutations for the current flush, and the browser has had one animation frame to settle layout.voidOptional controller name (used in debugging)voidsetOnChanges(Controller.OnChangesCallback onChanges) Called whenever one-way bindings are updated.voidsetOnDestroy(Controller.OnDestroyCallback onDestroy) Called on a controller when its containing scope is destroyed.voidsetOnInit(Controller.OnInitCallback onInit) Called on each controller after all the controllers on an element have been constructed and had their bindings initialized (and before the pre & post linking functions for the directives on this element).voidsetPostLink(Controller.PostLinkCallback postLink) Called after this controller's element and its children have been linked.
-
Method Details
-
create
-
getAfterRender
Called after this controller has been linked, AngularTS has applied DOM mutations for the current flush, and the browser has had one animation frame to settle layout. Multiple schedules for the same controller in one flush are coalesced into one call. -
getName
Optional controller name (used in debugging) -
getOnChanges
Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound properties that have changed, and the values are aChangesObjectobject of the form { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as cloning the bound value to prevent accidental mutation of the outer value. -
getOnDestroy
Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources, watches and event handlers. -
getOnInit
Called on each controller after all the controllers on an element have been constructed and had their bindings initialized (and before the pre & post linking functions for the directives on this element). This is a good place to put initialization code for your controller. -
getPostLink
Called after this controller's element and its children have been linked. Similar to the post-link function this hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain templateUrl directives will not have been compiled and linked since they are waiting for their template to load asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather different in Angular 1 there is no direct mapping and care should be taken when upgrading. -
setAfterRender
Called after this controller has been linked, AngularTS has applied DOM mutations for the current flush, and the browser has had one animation frame to settle layout. Multiple schedules for the same controller in one flush are coalesced into one call. -
setName
Optional controller name (used in debugging) -
setOnChanges
Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound properties that have changed, and the values are aChangesObjectobject of the form { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as cloning the bound value to prevent accidental mutation of the outer value. -
setOnDestroy
Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources, watches and event handlers. -
setOnInit
Called on each controller after all the controllers on an element have been constructed and had their bindings initialized (and before the pre & post linking functions for the directives on this element). This is a good place to put initialization code for your controller. -
setPostLink
Called after this controller's element and its children have been linked. Similar to the post-link function this hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain templateUrl directives will not have been compiled and linked since they are waiting for their template to load asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather different in Angular 1 there is no direct mapping and care should be taken when upgrading.
-