angular-cn/public/docs/js/latest/api/lifecycle_hooks/OnDestroy-interface.jade

36 lines
789 B
Plaintext

p.location-badge.
exported from <a href='../lifecycle_hooks'>angular2/lifecycle_hooks</a>
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.37/modules/angular2/src/core/compiler/interfaces.ts#L93-L109">angular2/src/core/compiler/interfaces.ts (line 93)</a>
:markdown
Notify a directive whenever a <a href='../core/ViewMetadata-class.html'><code>ViewMetadata</code></a> that contains it is destroyed.
## Example
```
@Component(...)
class MyComponent implements OnDestroy {
onDestroy(): void {
// invoked to notify directive of the containing view destruction.
}
}
```
.l-main-section
h2 Members
.l-sub-section
h3#onDestroy onDestroy
pre.prettyprint
code.
onDestroy()
:markdown