微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

nz-option 就像一个默认值

如何解决nz-option 就像一个默认值

目前我正在处理 3 个事物的预加载信息,2 个选择选项和一个表,“业务对象”和“表”填充得很好,替换了 ngModel 变量的值,但是,对于 fileName,同样的事情没有发生;文件名就像唯一的“选项”一样,但没有“认”选择,我试图用“defaultValue”来管理它,就像文档说的那样,但不起作用。知道我该怎么做吗?

这是我的实际代码

ngOnInit(): void {
      this.sel_businessObject = JSON.parse(localStorage.getItem("businessObjSelected"));
      this.fileNametoEdit = JSON.parse(localStorage.getItem("fileNameSelected"));
      console.log('LALALALA',this.fileNametoEdit);
      this.dataMappingData = JSON.parse(localStorage.getItem("dataMappingCashedData"));

        // Call API to Load Business Object
        this.mappingService.businessObject().subscribe((business: any) => {
            //debugger;
            this.listBusinessObj = business;
        })

<div class="col col-4">
<label> Data Filename
<small>*</small>
</label> <br />
<nz-select nzShowSearch nzAllowClear nzPlaceHolder="Select Filename" name="sel_fileName"
[(ngModel)]="this.sel_fileName" (ngModelChange)="fileNameListChangeEvt()">
<nz-option *ngFor="let fineName of listFileNameObj" [nzLabel]="fineName"
[nzValue]="fineName"></nz-option>
<nz-option *ngIf="fileNametoEdit !== 'null'" [nzLabel]="this.fileNametoEdit"
[nzValue]="this.fileNametoEdit"></nz-option>
</nz-select>
</div>

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。