dev*_*r10 3 javascript angularjs angular-ui angularjs-directive
我为此创建了一个plunker:http://plnkr.co/edit/5nk4BnYoO52En7P6kPu9
选择选项,但是当您选择一个时,ui-select保留为空白.潜在的重要说明:我在指令(ui-bootstrap)中使用它.作为旁注 - 在plunker中没有包装指令,所以这不是罪魁祸首.
<ui-select search-enabled="true" ng-change="updateMedu()" style="width: 100%" ng-model="medications.chosenMedications.metadata.conceptGroup.conceptProperties">
<ui-select-match placeholder="Please click to choose or start typing dosage value..">{{$item}}</ui-select-match>
<ui-select-choices repeat="cp in medications.chosenMedications.metadata[key].conceptGroup[1].conceptProperties | filter: $select.search">
{{cp.synonym}}
</ui-select-choices>
</ui-select>
Run Code Online (Sandbox Code Playgroud)
手动模拟数据集:
$scope.medications.chosenMedications.metadata = [
{
conceptGroup: [
{
conceptProperties: [
{synonym: "Item One"},
{synonym: "Item Two"},
{synonym: "Item Three"}
]
},
{
conceptProperties: [
{synonym: "Item A"},
{synonym: "Item B"},
{synonym: "Item C"}
]
}
]
}
];
Run Code Online (Sandbox Code Playgroud)
只需尝试以下代码:
<ui-select theme="select2" search-enabled="true" style="width: 100%"
ng-model="medications.chosenMedications.metadata.conceptGroup.conceptProperties">
<ui-select-match placeholder="Click to select or start typing...">
{{$select.selected.synonym}}
</ui-select-match>
<ui-select-choices repeat="cp in medications.chosenMedications.metadata[0].conceptGroup[1].conceptProperties | filter: $select.search">
{{cp.synonym}}
</ui-select-choices>
</ui-select>
Run Code Online (Sandbox Code Playgroud)
你的问题是你尝试显示{{$item}}而不是{{$select.selected.synonym}}
希望,这将解决您的问题.
| 归档时间: |
|
| 查看次数: |
4476 次 |
| 最近记录: |