forked from NG-ZORRO/ng-zorro-antd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:select): support default value not in the option list (NG…
…-ZORRO#4261) close NG-ZORRO#3672 close NG-ZORRO#4000
- Loading branch information
Showing
9 changed files
with
66 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 19 | ||
title: | ||
zh-CN: 默认数据 | ||
en-US: Default Value | ||
--- | ||
|
||
## zh-CN | ||
|
||
当需要显示默认值,同时默认值又不在选项列表中时,可以使用 `nzHide` 在 `nz-option` 中将默认选项隐藏 | ||
|
||
## en-US | ||
|
||
Display a default value that not in the option list with `nzHide` in `nz-option` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-select-default-value', | ||
template: ` | ||
<nz-select | ||
style="width: 100%" | ||
nzMode="multiple" | ||
nzPlaceHolder="Inserted are removed" | ||
[(ngModel)]="listOfSelectedValue" | ||
> | ||
<nz-option *ngFor="let option of listOfOption" [nzLabel]="option" [nzValue]="option"></nz-option> | ||
<nz-option *ngFor="let option of defaultOption" [nzLabel]="option" [nzValue]="option" nzHide></nz-option> | ||
</nz-select> | ||
<br /> | ||
<br /> | ||
<nz-select style="width: 100%" [(ngModel)]="selectedValue"> | ||
<nz-option *ngFor="let option of listOfOption" [nzLabel]="option" [nzValue]="option"></nz-option> | ||
<nz-option nzLabel="Default Value" nzValue="Default" nzHide></nz-option> | ||
</nz-select> | ||
` | ||
}) | ||
export class NzDemoSelectDefaultValueComponent { | ||
listOfOption = ['Option 01', 'Option 02']; | ||
listOfSelectedValue = ['Default 01', 'Default 02']; | ||
defaultOption = [...this.listOfSelectedValue]; | ||
|
||
selectedValue = 'Default'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters