40 lines
820 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#L52-L72">angular2/src/core/compiler/interfaces.ts (line 52)</a>
:markdown
Notify a directive when it has been checked the first time.
`onInit` is called right after the directive's bindings have been checked for the first time,
and before any of its children's bindings have been checked.
It is invoked only once.
## Example
```
@Component(...)
class MyComponent implements OnInit {
onInit(): void {
}
}
```
.l-main-section
h2 Members
.l-sub-section
h3#onInit onInit
pre.prettyprint
code.
onInit()
:markdown