Angular 如何在加载组件时触发(更改)选择选项
更好的解决方案是使用如下ngModel:Angular 如何在加载组件时触发(更改)选择选项,angular,Angular,更好的解决方案是使用如下ngModel: onChange(selectedStatus: string) { console.log(selectedStatus); } selectedValue="Running"; 但是,如果您坚持使用事件,您可以像这样使用ngAfterViewInit: onChange(selectedStatus: string) { console.log(selectedStatus); } selectedValue="Running"; 您
onChange(selectedStatus: string) {
console.log(selectedStatus);
}
selectedValue="Running";
但是,如果您坚持使用事件,您可以像这样使用ngAfterViewInit:
onChange(selectedStatus: string) {
console.log(selectedStatus);
}
selectedValue="Running";
您可以在角度和火焰更改事件上使用HTMLElement
ngAfterViewInit{
this.onChange("Running");
}
你不需要这么做吗?选择的标准html
应该这样做,或者使用ngModel
let element:HTMLElement=document.getElementById('') as HTMLElement;
element.onchange(undefined);