|
1 | | -import { Component } from '@angular/core'; |
| 1 | +import { Component, signal } from '@angular/core'; |
2 | 2 | import { FormsModule } from '@angular/forms'; |
3 | 3 |
|
| 4 | +import { NzCascaderModule } from 'ng-zorro-antd/cascader'; |
| 5 | +import { NzIconModule } from 'ng-zorro-antd/icon'; |
4 | 6 | import { NzInputModule } from 'ng-zorro-antd/input'; |
5 | 7 | import { NzSelectModule } from 'ng-zorro-antd/select'; |
6 | 8 |
|
7 | 9 | @Component({ |
8 | 10 | selector: 'nz-demo-input-addon', |
9 | | - imports: [FormsModule, NzInputModule, NzSelectModule], |
| 11 | + imports: [NzInputModule, NzIconModule, NzSelectModule, NzCascaderModule, FormsModule], |
10 | 12 | template: ` |
11 | | - <nz-input-group nzAddOnBefore="Http://" nzAddOnAfter=".com"> |
12 | | - <input type="text" nz-input [(ngModel)]="inputValue" /> |
13 | | - </nz-input-group> |
| 13 | + <nz-input-wrapper> |
| 14 | + <span nzInputAddonBefore>http://</span> |
| 15 | + <input nz-input [(ngModel)]="value" /> |
| 16 | + <span nzInputAddonAfter>.com</span> |
| 17 | + </nz-input-wrapper> |
14 | 18 | <br /> |
15 | 19 | <br /> |
16 | | - <nz-input-group [nzAddOnBefore]="addOnBeforeTemplate" [nzAddOnAfter]="addOnAfterTemplate"> |
17 | | - <input type="text" nz-input [(ngModel)]="inputValue" /> |
18 | | - </nz-input-group> |
19 | | - <ng-template #addOnBeforeTemplate> |
20 | | - <nz-select [ngModel]="'Http://'"> |
| 20 | + <nz-input-wrapper> |
| 21 | + <nz-select nzInputAddonBefore [ngModel]="'Http://'"> |
21 | 22 | <nz-option nzLabel="Http://" nzValue="Http://"></nz-option> |
22 | 23 | <nz-option nzLabel="Https://" nzValue="Https://"></nz-option> |
23 | 24 | </nz-select> |
24 | | - </ng-template> |
25 | | - <ng-template #addOnAfterTemplate> |
26 | | - <nz-select [ngModel]="'.com'"> |
| 25 | + <input nz-input [(ngModel)]="value" /> |
| 26 | + <nz-select nzInputAddonAfter [ngModel]="'.com'"> |
27 | 27 | <nz-option nzLabel=".com" nzValue=".com"></nz-option> |
28 | 28 | <nz-option nzLabel=".jp" nzValue=".jp"></nz-option> |
29 | 29 | <nz-option nzLabel=".cn" nzValue=".cn"></nz-option> |
30 | 30 | <nz-option nzLabel=".org" nzValue=".org"></nz-option> |
31 | 31 | </nz-select> |
32 | | - </ng-template> |
| 32 | + </nz-input-wrapper> |
33 | 33 | <br /> |
34 | 34 | <br /> |
35 | | - <nz-input-group nzAddOnAfterIcon="setting"> |
36 | | - <input type="text" nz-input [(ngModel)]="inputValue" /> |
37 | | - </nz-input-group> |
| 35 | + <nz-input-wrapper> |
| 36 | + <input nz-input [(ngModel)]="value" /> |
| 37 | + <nz-icon nzInputAddonBefore nzType="setting" /> |
| 38 | + </nz-input-wrapper> |
| 39 | + <br /> |
| 40 | + <br /> |
| 41 | + <nz-input-wrapper> |
| 42 | + <span nzInputAddonBefore>http://</span> |
| 43 | + <input nz-input [(ngModel)]="value" /> |
| 44 | + <span nzInputSuffix>.com</span> |
| 45 | + </nz-input-wrapper> |
| 46 | + <br /> |
| 47 | + <br /> |
| 48 | + <nz-input-wrapper> |
| 49 | + <nz-cascader nzInputAddonBefore [nzOptions]="[]" nzPlaceHolder="cascader" [style.width.px]="150" /> |
| 50 | + <input nz-input [(ngModel)]="value" /> |
| 51 | + </nz-input-wrapper> |
38 | 52 | ` |
39 | 53 | }) |
40 | 54 | export class NzDemoInputAddonComponent { |
41 | | - inputValue: string = 'my site'; |
| 55 | + readonly value = signal('mysite'); |
42 | 56 | } |
0 commit comments