Implement this interface to get notified when any data-bound property of your directive changes.

ngOnChanges is called right after the data-bound properties have been checked and before view and content children are checked if at least one of them has changed.

The changes parameter contains an entry for each changed data-bound property. The key is the property name and the value is an instance of SimpleChange.

Examples

Try this live example from the Lifecycle Hooks page:

ngOnChanges(Map<String, SimpleChange> changes) {
  changes.forEach((String propName, SimpleChange change) {
    String cur = JSON.encode(change.currentValue);
    String prev = change.previousValue == null
        ? "{}"
        : JSON.encode(change.previousValue);
    changeLog.add('$propName: currentValue = $cur, previousValue = $prev');
  });
}

Constructors

OnChanges()

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

ngOnChanges(Map<String, SimpleChange> changes) → dynamic
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(other) → bool
The equality operator. [...]
inherited