angular - 使用自定义字段重置 angular4 中的下拉值
问题描述
在将旧的 Angular 应用程序迁移到 Angular 4 时,我在 .js 文件自定义下拉菜单中遇到了这个问题
hps-dropdown model="studentRequest.CountryType" reset-id="countryResetId"
is-required="false" options="countryOptions" reset-
id="resetCountryRequestResetId">hps-dropdown
如何在 Angular 4 代码中使用 resetid:
function setDefaultCountry() {
var queryParams = $location.search();
if (queryParams.Region) {
---
---
});
if (RegionsArray.length > 0) {
Code = selectedArray[0].id;
// Reset the id to reflect values in drop down
this.countryResetId = new Date();
}
}
}
如何在角度 4 中调用相同以保持相同但是当我开始实现使用普通组合框而不是上面的模板并绑定所需的选项时。调用国家信息时,rest-id 的用途是什么。
<select class="form-control" id="country" name="country" (change)="onCountryChange($event.target.value)" [(ngModel)]="countrySelected" required>
<option value='' disabled="disabled">select</option>
<option *ngFor="let country of countryList">{{country.name}}</option>
</select>
基本上首先将加载国家/地区,然后根据它加载州。
解决方案
推荐阅读
- jmeter - JMeter ForEach 控制器覆盖输出变量名称?
- reactjs - 在使用 syncErrors 之前等待 redux-form 完成
- r - 根据另一个数据框中的 2 个变量删除数据框中的行
- ruby - 一种有效的组合成对组合而不重复的方法?
- python - 遍历元组并将索引值与列表中的项目进行比较
- php - Codeigniter 更新数据库中的数据
- javascript - 如何将参数传递给 addEventListener 的回调函数
- ios - 接受/拒绝 EKEvent 邀请
- powershell - 无法从 Exchange cmdlet 捕获/重定向警告
- docker-compose - 如何在 ecs-cli 上运行 docker compose 时修复“无法解组 !!str `image:j...` into config.RawService”错误?