DoCheck class abstract

Implement to execute ngDoCheck and implement your own change detection.

By default, AngularDart does an identity based change detection of all input bindings (@Input()). That is, for an @Input() Object a, if the expression identical(oldA, newA) is false, AngularDart will invoke comp.a = newA (and call AfterChanges.ngAfterChanges, if implemented).

When DoCheck is implemented, AngularDart will invoke ngDoCheck() every time the component was checked for changes, regardless of whether the identity of an @Input() has changed, giving the user the opportunity to perform manual checks for mutations.

The ngDoCheck lifecylce is used by NgFor, NgStyle and NgClass, for example, in order to update when the contents of the passed in collection (either Iterable or Map) changes, not necessarily just if the identity changes.

WARNING: It is invalid to trigger any asynchronous event in ngDoCheck. Doing so may cause an infinite loop, as DoCheck will continue to be called and the asynchronous events will invalidate the state.

WARNING: It is invalid to implement both DoCheck and OnChanges or AfterChanges. ngOnChanges and ngAfterChanges will never be called, as ngDoCheck is used instead of the default change detector.

Implementers

Constructors

DoCheck()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

ngDoCheck() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited