【发布时间】:2023-03-15 05:15:01
【问题描述】:
我使用 Bootstrap 选择进行搜索和多项选择,但问题是当我在 ng-repeat 中使用 $scope 对象作为选项时,它不起作用。我在下面给出了我的代码。
<select name="name" ng-model="city.id" class="selectpicker" data-live-search="true" ng-options="o._id as o.name for o in stateList" ></select>
<select name="name" ng-model="city.id" class="selectpicker" data-live-search="true" ><option ng-repeat="option in stateList" value="{[{option._id}]}">{[{option.name}]}</option>
我已经使用了 options 和 ng-option 方法,但仍然没有显示对象...
这是我需要在选择中重复的状态对象...
$scope.stateList = [{"_id":"1","name":"www"},{"_id":"2","name":"bgg"}]
希望您了解我的问题,如果您需要更多详细信息 请发表评论,我正在等待您的建议...
【问题讨论】:
-
你能在这里写下你的完整代码结构吗...
-
现在可以为您提供代码吗@AnilKumarRam
-
当我使用像 $scope.value = ['1','2','3']; 这样的数组时我可以在 ng-repeat 中获取值,它显示在下拉列表中,但是当我使用对象执行此操作时,没有显示。
-
我已经为你创建了小提琴检查并回复jsfiddle.net/fA968/257
-
如您所知,我使用 bootstrap-select 和 angularjs 进行搜索并在下拉列表中选择,因此您共享的小提琴包含 angularjs 中的正常下拉列表...请查看此链接以获取示例下拉列表silviomoreto.github.io/bootstrap-select/examples/#live-search 并且我正在使用搜索进行多项选择...
标签: angularjs twitter-bootstrap angularjs-scope angular-ui-bootstrap