#abc在组件中叫什么? [英] What's #abc called in component?

查看:243
本文介绍了#abc在组件中叫什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< app-abc#abc></app-abc>

#abc叫什么?我们如何在父组件中引用#abc?

What's #abc called? How do we refer to #abc inside parent component?

推荐答案

这是在组件中引用HTML元素的一种方法.这是在父组件中引用#abc的方法:

it's a way to refer HTML element in your component. Here is the way to refer to #abc inside parent component:

import {ViewChild, ElementRef} from '@angular/core';

export class YourClass {
    // Reference firstNameInput variable inside Component
    @ViewChild('abc') nameInputRef: ElementRef;
}

使用Angular 5模板引用变量

这篇关于#abc在组件中叫什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆