有没有办法在print("This is a random message")
print("This is another message")
print("This is getting boring")
<select>
中执行非严格比较,以便从模型中设置初始值?例如,如果模型是整数且options键属性是字符串值,则遗憾的是ngOptions
初始值未设置。
<select>
<div ng-app="app">
<div ng-controller="Controller">
<select data-ng-model="model" data-ng-options="option.id as option.text for option in options"></select>
</div>
</div>
答案 0 :(得分:0)
如果我没弄错,您需要在ng-options中添加“track by”关键字,例如:
<select data-ng-model="model" data-ng-options="option.id as option.text for option in options track by option.id"></select>