ExpressionChangedAfterItHasBeenCheckedException class
An error thrown if application changes model breaking the top-down data flow.
This exception is only thrown in dev mode.
Example
@Component({
selector: 'parent',
template: `
<child [prop]="parentProp"></child>
`,
directives: [forwardRef(() => Child)]
})
class Parent {
parentProp = "init";
}
@Directive({selector: 'child', inputs: ['prop']})
class Child {
constructor(public parent: Parent) {}
set prop(v) {
// this updates the parent property, which is disallowed during change detection
// this will result in ExpressionChangedAfterItHasBeenCheckedException
this.parent.parentProp = "updated";
}
}
- Implemented types
Constructors
- ExpressionChangedAfterItHasBeenCheckedException(dynamic oldValue, dynamic currValue, dynamic context)
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited