如何与ngIf-Angular 9一起触发选择更改事件

所以我有这个标记,它可以正常工作,除了当ngIf从dom中删除选项时,我需要立即触发change事件。

          <select
              class="form-control ml-1"
              (change)="selectOption($event.target.value,item.id)"
            >
              <ng-container *ngFor="let opt of selectOptions">
                <option
                  [value]="opt.id"
                  [selected]="opt.id == getDataType(item.id)"
                  *ngIf="
                    (opt.pie == true &&
                      layoutService.getcomponentRef(item.id) == 'pie') ||
                    (opt.line == true &&
                      layoutService.getcomponentRef(item.id) == 'line') ||
                    (opt.bar == true &&
                      layoutService.getcomponentRef(item.id) == 'bar')
                  "
                  >{{ opt.name }}</option
                >
              </ng-container>
            </select>
zmm22 回答:如何与ngIf-Angular 9一起触发选择更改事件

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2612398.html

大家都在问