错误:初始化后无法更改选择的`multiple'模式

问题描述 投票:0回答:1

错误图像:

Error image

 <div fxFlex.gt-lg="100" fxFlex="100" *ngIf="requestAction == 'add'">
                    <div class="pb-1">
                            <md2-select placeholder="{{'WidgetType'|translate:lang}}" class="input_custom_width"(change)="widgetNode($event.value)"  required>
                                <md2-option *ngFor="let widgetType of widgetTypeAry" [value]="widgetType.value">
                                    {{widgetType.name}}
                                </md2-option>
                            </md2-select>
                    </div>
                </div>
              <div fxFlex.gt-lg="100" fxFlex="100" *ngIf="fieldsObj['node'] && showRequestAction" >
                <div class="pb-1">
                    <md2-select placeholder="{{'Node'|translate:lang}}" [formControl]="editWidgetForm.controls['nodeId']" [(ngModel)]="nodeId" class="input_custom_width" [(multiple)]="isMultiNode" (change)="nodeChange($event.value)" required>
                        <md2-select-header>
                            <md-input-container class="input_custom_width">
                                <input mdInput type="text" placeholder="{{'Search'| translate:lang}}" [ngModelOptions]="{standalone: true}" [(ngModel)]="searchNode"/>
                            </md-input-container>
                        </md2-select-header>
                        <md2-option *ngFor="let node of nodesAry | filterPipe : searchNode" [value]="node.value">
                            {{ node.name }}
                        </md2-option>
                    </md2-select>
                    <small *ngIf="editWidgetForm.controls['nodeId'].hasError('required') && editWidgetForm.controls['nodeId'].touched" class="mat-text-warn">{{'nodeReq'|translate:lang}}</small>
                </div>
              </div>

[当我在选择下拉列表中使用倍数时,它可以正常工作,但是当我使用[倍数]时,它仅以我的编辑形式而不能以加法形式工作。它给出了以上错误-错误:初始化后无法更改选择的multiple模式。帮助我解决这个问题。

html angular angular2-template angular2-forms angular4-forms
1个回答
0
投票

此问题有一个非常丑陋的解决方法,将您的Mat-select变形为* ngif = true,并创建一个具有Multiple属性的副本,并在其下方包裹一个* ngif =!true。>

© www.soinside.com 2019 - 2024. All rights reserved.