Angularjs 下拉菜单文本需要显示为下拉菜单的标题
Angularjs dropdown text need to be showing as a title of the dropdown
我有一个要求,我需要在下拉框的标题标签中显示 angularjs 下拉列表 (不是值) 的文本。我的 angular 代码是这样的:
<select id="inputID" name="inputName"
ng-options="item.value as item.display for item in genders"
ng-model="model.Base.currentRecord.value.Code.value" class="form-control input-sm">
<option value="">Select...</option> </select>
由于下拉菜单是动态生成的,因此选项的值和选项中的文本不同。在标题标签中,我可以使用 title={{model.Base.currentRecord.value.Code.value}}
获取值,但我需要文本而不是值。
有人知道吗?
这行得通吗? demo
<select id="inputID" title={{model.Base.currentRecord.value.Code.display}} name="inputName" ng-options=" item.display for item in genders"
ng-model="model.Base.currentRecord.value.Code" class="form-control input-sm">
<option value="">Select...</option>
</select>
<strong>Selected value:</strong> {{model.Base.currentRecord.value.Code.value}}
我有一个要求,我需要在下拉框的标题标签中显示 angularjs 下拉列表 (不是值) 的文本。我的 angular 代码是这样的:
<select id="inputID" name="inputName"
ng-options="item.value as item.display for item in genders"
ng-model="model.Base.currentRecord.value.Code.value" class="form-control input-sm">
<option value="">Select...</option> </select>
由于下拉菜单是动态生成的,因此选项的值和选项中的文本不同。在标题标签中,我可以使用 title={{model.Base.currentRecord.value.Code.value}}
获取值,但我需要文本而不是值。
有人知道吗?
这行得通吗? demo
<select id="inputID" title={{model.Base.currentRecord.value.Code.display}} name="inputName" ng-options=" item.display for item in genders"
ng-model="model.Base.currentRecord.value.Code" class="form-control input-sm">
<option value="">Select...</option>
</select>
<strong>Selected value:</strong> {{model.Base.currentRecord.value.Code.value}}