ui select ui-select-选择在每个项目中使用数组而不是纯文本

ui select ui-select-choices using array in each item rather than plain text

我想对 json 项中的数组使用 ui select:

我在html

中使用了uiselect
<div class="col-xs-12 col-sm-3 col-md-2 pad-left-right-0 filter">
    <span>Labels</span> 
    <ui-select multiple ng-model="labels.selected" ng-change="refreshData()" theme="bootstrap">
    <ui-select-match >{{$item.name}}</ui-select-match>
    <ui-select-choices repeat="item in data | filter: $select.search">
         <div ng-bind-html="item.labels | highlight: $select.search"></div>
    </ui-select-choices>
  </ui-select> 
</div>

我json在每个数组元素中包含数组

{data: [{
    "developer": "dev",
      "team": "MP",
      "qa": "dev",
      "pm": "dev",
      "jTicket": {
        "jId": "test",
        "jUrl": "jurl",
        "issueType": "Story",
        "jSummary": "test"
      },
      "mr": {
        "number": 25767,
        "title": "test",
        "url": "url",
        "links": [],
        "screenShotLinks": [
          "url_here"
        ],
        "testLinks": [],
        "description": "",
        "labels": ["label 2", "label 5", "label 8"]
      }
    }]}

我想在数据 json 的每个项目中填充 ui select ui-select-使用标签 [] 的选择。但是没有标签被填充。

您正在记录标签,因为 标签 密钥不在主节点上。它在 mr 对象中。相反,你可以像这样使用它,

<div ng-bind-html="item.mr.labels | highlight: $select.search"></div>

希望能解决您的问题。