相关疑难解决方法(0)

我应该如何在Angular 8中为@ViewChild使用新的static选项?

我应该如何配置新的Angular 8视图子级?

@ViewChild('searchText', {read: ElementRef, static: false})
public searchTextInput: ElementRef;
Run Code Online (Sandbox Code Playgroud)

@ViewChild('searchText', {read: ElementRef, static: true})
public searchTextInput: ElementRef;
Run Code Online (Sandbox Code Playgroud)

哪个更好?什么时候应该使用static:truevs static:false

typescript viewchild angular angular8

125
推荐指数
4
解决办法
3万
查看次数

标签 统计

angular ×1

angular8 ×1

typescript ×1

viewchild ×1