It is not clear in the Docs about {read: xx} option for @ViewChild.

Based on the Source code, @ViewChild as view as Component, ElementRef, TemplateRef.

For example, we have:

<one></one>
  @ViewChild(OneComponent)
one: OneComponent;
  ngAfterViewInit() {
console.log('after', this.one);
}

Now we read 'OneComponent' as a component, if we want to read it as ElementRef, we can do:

  @ViewChild(OneComponent, {read: ElementRef})
one: ElementRef;

[NOTICE]:

One thing to notice is that @ViewChild is only for viewing the its own component tamplate, you cannot view its child component template or parent component template

最新文章

  1. centos6.6 安装jdk1.7
  2. PAT 1039. 到底买不买(20)
  3. 使用Ninject进行DI(依赖注入)
  4. Python + OpenCV2 系列:2 - 图片操作
  5. 手动给控制器添加xib
  6. springmvc之interceptor(拦截器)
  7. 设计前沿:25款精妙的 iOS 应用程序图标
  8. ASP.NET XML与JSON
  9. Rsync同步工具安装文档
  10. BZOJ 2809 APIO2012 dispatching Treap+启示式合并 / 可并堆
  11. windows phone (21) Grid元素的Background和Clip
  12. IBATIS事务处理 - - 博客频道 - CSDN.NET
  13. Day8 接口与归一化设计
  14. for break
  15. 【特征提取】MultiBlock-LBP特征
  16. HDOJ 2001 计算两点间的距离
  17. SpringMVC RestTemplate的几种请求调用
  18. supervisor管理uwsgi
  19. Hdu4903 The only survival
  20. Java基础(十四):泛型

热门文章

  1. J2SE总结(一)-------容器
  2. vim编辑器快捷运用
  3. Instruments Tutorial for iOS: How To Debug Memory Leaks
  4. aiohttp的学习
  5. Kotlin来了
  6. Laravel 项目使用 Carbon 人性化显示文章发表时间
  7. Python与数据库[2] -&gt; 关系对象映射/ORM[3] -&gt; sqlalchemy 的声明层 ORM 访问方式
  8. 宠物收养所 (SBT)
  9. kibana- Pie
  10. 多模态检索之CCA算法