更改后如何更新 angular 中的单个 var
How to update a single var in angular after change
我有一个在步骤 n.1 上具有以下 select 的步进器:
<nb-select selected="INFO" (selectedChange)="changeStepperIDDevice($event)" placeholder="Disabled option">
<nb-option value="INFO" disabled>Select Device...</nb-option>
<nb-option *ngFor="let obj of deviceIDList" [value]="obj">{{obj}}</nb-option>
</nb-select>
当我选择我的设备时
changeStepperIDDevice = async (event) => {
this.selectedStepperIDDevice = event;
}
在步骤 n.2 中,我将相同的 select 与 obj selected
<nb-select selected="DEVICE" disabled placeholder="Disabled">
<nb-option value="DEVICE">{{selectedStepperIDDevice}}</nb-option>
</nb-select>
但 id 不起作用...它是空的...如果我,例如,输入做同样的事情
<input type="text" nbInput placeholder={{selectedStepperIDDevice}} disabled size="40%" />
它可以工作...它向我展示了 selected 设备...但我只想让它与 select 一起工作,这样我就可以逐步设置设备
谁能帮帮我?
非常感谢
就这样修复:
删除:
<nb-select selected="DEVICE" disabled placeholder="Disabled">
<nb-option value="DEVICE">{{selectedStepperIDDevice}}</nb-option>
</nb-select>
并添加:
<nb-select #myselect [selected]="selectedStepperIDDevice" disabled placeholder="Disabled">
<nb-option *ngFor="let obj of deviceIDList" [value]="obj">{{obj}}</nb-option>
</nb-select>
我有一个在步骤 n.1 上具有以下 select 的步进器:
<nb-select selected="INFO" (selectedChange)="changeStepperIDDevice($event)" placeholder="Disabled option">
<nb-option value="INFO" disabled>Select Device...</nb-option>
<nb-option *ngFor="let obj of deviceIDList" [value]="obj">{{obj}}</nb-option>
</nb-select>
当我选择我的设备时
changeStepperIDDevice = async (event) => {
this.selectedStepperIDDevice = event;
}
在步骤 n.2 中,我将相同的 select 与 obj selected
<nb-select selected="DEVICE" disabled placeholder="Disabled">
<nb-option value="DEVICE">{{selectedStepperIDDevice}}</nb-option>
</nb-select>
但 id 不起作用...它是空的...如果我,例如,输入做同样的事情
<input type="text" nbInput placeholder={{selectedStepperIDDevice}} disabled size="40%" />
它可以工作...它向我展示了 selected 设备...但我只想让它与 select 一起工作,这样我就可以逐步设置设备
谁能帮帮我?
非常感谢
就这样修复:
删除:
<nb-select selected="DEVICE" disabled placeholder="Disabled">
<nb-option value="DEVICE">{{selectedStepperIDDevice}}</nb-option>
</nb-select>
并添加:
<nb-select #myselect [selected]="selectedStepperIDDevice" disabled placeholder="Disabled">
<nb-option *ngFor="let obj of deviceIDList" [value]="obj">{{obj}}</nb-option>
</nb-select>