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. Navicat Premuim远程连接oracle 提示 cannot load oci dll,193的解决方法

    转载:http://blog.51cto.com/xiao987334176/1640991 内网有一台windows server 2012,安装了Navicat 11.1.8 连接oracle的时 ...

  2. uploadify上传插件参数的一些设置

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. 用HTML5 Geolocation实现一个距离追踪器

    HTML5 Geolocation(地理定位)用于定位用户的位置.那么如何实现一个距离追踪器呢?我的思路是这样的,前提是浏览器支持h5地理定位,在这个基础上,获取用户位置,更新用户位置,计算距离,显示 ...

  4. mui初级入门教程(四)— 再谈webview,从小白变“大神”!

    文章来源:小青年原创发布时间:2016-06-05关键词:mui,html5+,webview转载需标注本文原始地址: http://zhaomenghuan.github.io/#!/blog/20 ...

  5. 深入探究JVM(1) - Java的内存区域解析

    http://blog.csdn.net/sczyh22/article/details/46652901<br>Java 虚拟机在执行Java程序的时候会把它管理的内存区域划为几部分,这 ...

  6. Oracle Flashback Database

    Oracle Flashback Database Ensure that the prerequisites described in Prerequisites of Flashback Data ...

  7. 去掉IE浏览器里的脚本控件提示

    如果是你在网站制作网站让后进行测试,直接在IE浏览器中打开本地含有脚本或者ActiveX控件的页面时,IE就会弹出一个提示栏,说:”为了有利于保护安全性,Internet Explorer己限制此网页 ...

  8. 四种方法给Vmware虚拟机清理瘦身

    随着VMware虚拟机使用时间的增长,其所占用的空间也越来越大,本文来说说怎么给VMware虚拟机占用的空间进行瘦身. **方法一:VMware自带的清理磁盘 **这个方法是VMware自带,具有普适 ...

  9. Nginx 日志切割(Logrotate)

    Logrotate 配置文件 # ls /etc/logrotate.* /etc/logrotate.conf /etc/logrotate.d: cups dracut fmdcn httpd i ...

  10. android window(三)lWindow添加流程

    http://androidxref.com/6.0.1_r10/xref/frameworks/base/services/core/java/com/android/server/wm/Windo ...