import { Component, OnInit, Input, OnChanges, SimpleChanges, DoCheck } from '@angular/core';

@Component({
selector: 'app-child',
templateUrl: './child.component.html',
styleUrls: ['./child.component.css']
})
export class ChildComponent implements OnInit, OnChanges, DoCheck { @Input()
greeting: string; @Input()
user: {}; message = 'hello'; constructor() { } ngOnInit() {
} ngOnChanges(changes: SimpleChanges): void {
console.log(JSON.stringify(changes, null, ));
} ngDoCheck(): void {
console.log('子组件Docheck');
} }
<div>子组件</div>
<p>问候语{{greeting}}</p>
<p>用户{{user.name}}</p>
<input [(ngModel)]='message'>
import { Component, DoCheck } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements DoCheck { greeting = 'nihao';
user: { name: string } = { name: 'cys' }; ngDoCheck(): void {
console.log('父组件Docheck');
}
}
<input [(ngModel)]="greeting" type="text">
<input [(ngModel)]="user.name" type="text">
<app-child [greeting]="greeting" [user]="user"></app-child>

angular Docheck的更多相关文章

  1. angular利用ui-router登录检查

    angular利用ui-router登录检查 SAP都会有这个问题,session过期或者页面被刷新的情况下应该进入登录页. 监听ui-router的satte事件可以实现当state切换的时候检查登 ...

  2. Angular组件——组件生命周期(一)

    组件声明周期以及angular的变化发现机制 红色方法只执行一次. 变更检测执行的绿色方法和和组件初始化阶段执行的绿色方法是一个方法. 总共9个方法. 每个钩子都是@angular/core库里定义的 ...

  3. Angular 个人深究(四)【生命周期钩子】

    Angular 个人深究(四)[生命周期钩子] 定义: 每个组件都有一个被 Angular 管理的生命周期. Angular 创建它,渲染它,创建并渲染它的子组件,在它被绑定的属性发生变化时检查它,并 ...

  4. angular中的 登录检查 和 过期Session清理

    angular利用ui-router进行登录检查 SAP都会有这个问题,session过期或者页面被刷新的情况下应该进入登录页. 监听ui-router的satte事件可以实现当state切换的时候检 ...

  5. Angular 5.x 学习笔记(2) - 生命周期钩子 - 暂时搁浅

    Angular 5.x Lifecycle Hooks Learn Note Angular 5.x 生命周期钩子学习笔记 标签(空格分隔): Angular Note on cnblogs.com ...

  6. [Angular] Zones and NgZone

    NgZone, Angular uses it to profiling all the async actions such as setTimeout, http request and anim ...

  7. Angular生命周期理解

    Angular每个组件,包含根组件和每一级的子组件,都存在一个生命周期,从创建,变更到销毁.Angular提供组件生命周期钩子,把这些关键时刻暴露出来,赋予在这些关键结点和组件进行交互的能力. 在An ...

  8. Angular 学习笔记 (动态组件 & Material Overlay & Dialog 分析)

    更新: 2019-11-24  dialog vs router link refer : https://stackoverflow.com/questions/51821766/angular-m ...

  9. Angular 变更检测

    angular 的钩子函数有 content 和 view , Docheck 子控件中有属性变化的时候,父组件的 Docheck  content   view  这3个会依次执行,即使这个属性不在 ...

随机推荐

  1. MFC学习(四) 消息机制

    1 消息机制的要点: 消息队列:先进先出 消息循环:通过循环while,不断的从消息队列中取得队首消息,并分发消息. 消息处理:根据不同的消息类型做不同的处理 事件:事件响应函数 2 消息机制 _tW ...

  2. md5加密小程序

    #-*- coding:utf-8 -*- __author__ = "MuT6 Sch01aR" import hashlib m = hashlib.md5() m.updat ...

  3. 一次 Mysql 字符集的报错,最后让我万马奔腾!!!

    wuba---深圳---龙岗周边----3000元--------- wuba---深圳---龙岗周边----5000元--------- wuba---深圳---龙岗周边----8000元----- ...

  4. Pacemaker实现双机热备

    在互联网高速发展的今天,尤其在电子商务的发展,要求服务器能够提供不间断服务.在电子商务中,如果服务器宕机,造成的损失是不可估量的.要保证服务器不间断服务,就需要对服务器实现冗余.在众多的实现服务器冗余 ...

  5. Hadoop之MapReduce(二)序列化,排序及分区

    MapReduce的序列化 序列化(Serialization)是指把结构化对象转化为字节流. 反序列化(Deserialization)是序列化的逆过程.把字节流转为结构化对象. 当要在进程间传递对 ...

  6. C#获取访问者ip和获取本机ip地址

    获取访问者ip: string userIP; // HttpRequest Request = HttpContext.Current.Request; HttpRequest Request = ...

  7. Eclipse导入tomcat服务器

    创建server

  8. Setting up an OpenGL development environment in ubuntu

    1.opening terminal window and entering the apt-get command for the packages: sudo apt-get install me ...

  9. SpringBoot16 MockMvc的使用、JsonPath的使用、请求参数问题、JsonView、分页查询参数、JsonProperty

    1 MockMvc的使用 利用MockMvc可以快速实现MVC测试 坑01:利用MockMvc进行测试时应用上下文路径是不包含在请求路径中的 1.1 创建一个SpringBoot项目 项目脚手架 1. ...

  10. Python编写两个数的加减法游戏

    目标: 1.实现两个数的加减法 2.回答者3次输错计算结果后,输出正确结果,并询问回答者是否继续 1.使用常规函数实现两个数的加减法游戏 代码如下: #!/usr/bin/env python # - ...