要解决"angular2-query-builder的下拉值没有重置/更新"的问题,你可以尝试以下解决方法:
import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
@Component({
selector: 'app-your-component',
template: `
`
})
export class YourComponent {
dropdownControl = new FormControl('');
dropdownOptions = ['Option 1', 'Option 2', 'Option 3'];
resetDropdown() {
this.dropdownControl.reset('');
}
}
在这个示例中,当点击"Reset"按钮时,调用resetDropdown
方法会将下拉框的值重置为空。
import { Component } from '@angular/core';
@Component({
selector: 'app-your-component',
template: `
`
})
export class YourComponent {
selectedOption = '';
dropdownOptions = ['Option 1', 'Option 2', 'Option 3'];
resetDropdown() {
this.selectedOption = '';
}
}
在这个示例中,当点击"Reset"按钮时,调用resetDropdown
方法会将下拉框的值重置为空。
这些方法都是基于Angular的表单处理机制来实现的。根据你的具体情况,你可以选择其中一个来解决你的问题。
上一篇:Angular2-Propertyisundefinedaftersubscriptionended
下一篇:Angular2-scrollPositionRestoration:'enabled'doesnotworkoneverycomponent。