-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select组件指定值时不能切换 #5618
Comments
Translation of this issue:Select the specified value can not switch the componentReproduction linkHttps://stackblitz.com/edit/angular-pea3sc Steps to reproducenz-select components when ngModelChange, manually specified value model What is expected?nz-select components when ngModelChange, the model values may be specified manually What is actually happening?model value can not be manually at change, value can only be selected item
@component ({ valueChange (value) { setValue () { |
请问这个问题什么时候能解决呢 |
这个和组件没有任何关系,在modelChange中重新改变model值是错误用法
|
Reproduction link
https://stackblitz.com/edit/angular-pea3sc
Steps to reproduce
nz-select组件在ngModelChange时,手动指定model值
What is expected?
nz-select组件在ngModelChange时,可以手动指定model的值
What is actually happening?
model值不能在change时手动指定,值只能是被选中的项目
@component({
selector: 'nz-demo-select-basic',
template:
<nz-select [(ngModel)]="selected" (ngModelChange)="valueChange($event)"> <nz-option nzValue="jack" nzLabel="Jack"></nz-option> <nz-option nzValue="lucy" nzLabel="Lucy"></nz-option> <nz-option nzValue="zoe" nzLabel="zoe"></nz-option> </nz-select> <button (click)="setValue()">test</button>
,styles: [
nz-select { margin: 0 8px 10px 0; width: 120px; }
]
})
export class NzDemoSelectBasicComponent {
selected = 'zoe'
valueChange(value) {
console.log(value)
this.selected = 'lucy';
}
setValue() {
this.selected = 'lucy';
}
}
The text was updated successfully, but these errors were encountered: