Angular的viewchild在使用的时候报错 undefined

1 检查是否在元素上打上标识 #xxx

2 查看引用元素时的时机 是否在AfterViewInit之后

3 检查元素是否在*ngIf="false"之内

参考:

https://stackoverflow.com/questions/34947154/angular-2-viewchild-annotation-returns-undefined

Angular Viewchild undefined的更多相关文章

  1. Angular ViewChild

    viewchild // 使用方法 git clone https://git.oschina.net/mumu-osc/learn-component.git cd learn-component ...

  2. Angular @ViewChild,Angular 中的 dom 操作

    Angular 中的 dom 操作(原生 js) ngAfterViewInit(){ var boxDom:any=document.getElementById('box'); boxDom.st ...

  3. angular ViewChild ContentChild 系列的查询参数

    官方说明 官方文档 在调用 NgAfterViewInit 回调函数之前就会设置这些视图查询. 元数据属性: selector - 用于查询的指令类型或名字. read - 从查询到的元素中读取另一个 ...

  4. [Angular] @ViewChild read custom directive and exportAs

    For example we have a component: <Card ></Card> And a driective: <Card highlighted> ...

  5. [Angular] ViewChild 'read' option

    It is not clear in the Docs about {read: xx} option for @ViewChild. Based on the Source code, @ViewC ...

  6. [Angular] @ViewChild and template #refs to get Element Ref

    We can use @ViewChild with component: @ViewChild(AuthMessageComponent) message: AuthMessageComponent ...

  7. Angular ViewChild & ViewChildren

    基础 ViewChild ViewChild 装饰器用于获取模板视图中的元素或直接调用其组件中的方法.它支持 Type 类型或 string 类型的选择器,同时支持设置 read 查询条件,以获取不同 ...

  8. AngularJs Angular数据类型判断

    angular.isArray 判断括号内的值是否为数组. 格式:angular.isArray(value); value: 被判断是否为数组的值. ------------------------ ...

  9. Angular - - Angular数据类型判断

    angular.isArray 判断括号内的值是否为数组. 格式:angular.isArray(value); value: 被判断是否为数组的值. ------------------------ ...

随机推荐

  1. Minimum Cut

    Minimum Cut Time Limit: 3000/2000 MS (Java/Others)    Memory Limit: 65535/102400 K (Java/Others)Tota ...

  2. Oracle Like子句

    Oracle Like子句 作者:初生不惑 Oracle基础 评论:0 条 Oracle技术QQ群:175248146 在本教程中,您将学习如何使用Oracle LIKE运算符来测试列中的值是否与指定 ...

  3. linux管理权限

    1.linux命令查询 root id 2.切换用户 su - xiaobai 一定要加"  -  "这个会将你的所有环境变量都带过来 3.root用户切换普通用户不需要输入密码反 ...

  4. VMware 虚拟化编程(8) — 多线程中的 VixDiskLib

    目录 目录 前文列表 多线程注意事项 多线程中的 VixDiskLib 前文列表 VMware 虚拟化编程(1) - VMDK/VDDK/VixDiskLib/VADP 概念简析 VMware 虚拟化 ...

  5. spring boot 1.5.10.RELEASE ,spring boot admin 1.5.7 添加 security

    生产环境的客户端actuator最好是加上security校验,不然配置信息不登录就能直接获取到 server端配置,参考官方 文档,https://codecentric.github.io/spr ...

  6. 应用安全 - 代码审计 -Java

    Java %c0%ae 安全模式绕过漏洞 原理 在Java端"%c0%ae"解析为"\uC0AE",最后转义为ASCCII低字符-".".通 ...

  7. FormData模拟表单上传图片

    [node]---multer模块实现图片上传---FORMDATA   1.安装muterl第三方模块 cnpm install multer --save 2.使用 multer在解析完成后,会向 ...

  8. oracle--表空间处理

    CREATE TABLESPACE命令详解(转) 表空间理解 https://www.cnblogs.com/kerrycode/p/3418694.html 常用操作 https://www.cnb ...

  9. Node.js实战8:可用于压缩、加密的zlib。

    zlib是nodejs内置的模块,有deflate.inflate函数,使用的是gzip算法,可用于压缩和解压,也可用于数据加密.解密. 如下示例: var zlib = require(" ...

  10. c语言秋季作业1

    1:你对软件工程专业或者计算机科学与技术专业了解是怎样? answer:据我上网了解软件工程是一门研究用工程化方法构建和维护有效的.实用的和高质量的软件的学科.它涉及程序设计语言.数据库.软件开发工具 ...