UI使用每个项目中的数组而不是纯文本选择UI选择的选择



我想在json项目中使用ui选择数组:

我在html

中使用了UI选择
<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>

i 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选择UI-SELECT-CHOICES。但是没有标签被人填充。

您正在注意lables,因为 lables 键不在主节点上。它的内部 MR 对象。相反,您可以这样使用它,

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

希望它能解决您的问题。

最新更新