AfterContentChecked

A lifecycle hook that is called after the default change detector has completed checking all content of a directive.

一个生命周期钩子,它会在默认的变更检测器对指令的所有内容完成了变更检查之后调用。

interface AfterContentChecked { ngAfterContentChecked(): void }

参见

方法

A callback method that is invoked immediately after the default change detector has completed checking all of the directive's content.

一个回调函数,会在默认的变更检测器对该指令下的所有内容完成了变更检测之后立即调用。

ngAfterContentChecked(): void

参数

没有参数。

返回值

void

使用说明

The following snippet shows how a component can implement this interface to define its own after-check functionality.

下列代码展示了组件如何实现该接口,已定义它在检查后要执行的自定义功能。

@Component({selector: 'my-cmp', template: `...`}) class MyComponent implements AfterContentChecked { ngAfterContentChecked() { // ... } }