exported from <a href='../annotations'>angular2/annotations</a>
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.33/modules/angular2/src/core/annotations_impl/annotations.ts#L900-L1037">angular2/src/core/annotations_impl/annotations.ts (line 900)</a>
:markdown
Lifecycle events are guaranteed to be called in the following order:
- `onChange` (optional if any bindings have changed),
- `onInit` (optional after the first check only),
- `onCheck`,
- `onAllChangesDone`
.l-main-section
h2 Members
.l-sub-section
h3 onDestroy
:markdown
Notify a directive whenever a <a href='View-var.html'><code>View</code></a> that contains it is destroyed.
```
@Directive({
...,
lifecycle: [LifecycleEvent.onDestroy]
})
class ClassSet {
onDestroy() {
// invoked to notify directive of the containing view destruction.
}
}
```
.l-sub-section
h3 onChange
:markdown
Notify a directive when any of its bindings have changed.
This method is called right after the directive's bindings have been checked,
and before any of its children's bindings have been checked.
It is invoked only if at least one of the directive's bindings has changed.