gpt4 book ai didi

javascript - 二维数组的 ng-repeat

转载 作者:太空宇宙 更新时间:2023-11-04 16:10:50 25 4
gpt4 key购买 nike

我有一个数组,其形式为

$scope.vehPermitTypevalue = [ [ "NP","National Permit"], ["IND_AP","Andra Pradesh"]];

HTML 代码:

 <ui-select name="permit" id ="permit" multiple ng-model="vehicle.selectedPermits"  on-select="getVehiclepermitId($item)"   ng-disabled="disabled" class="w-md mb-10">
<ui-select-match placeholder="Select or search a Permit Type in the list...">{{$item[1]}}</ui-select-match>
<ui-select-choices repeat="permittype in vehPermitTypevalue | filter:$select.search">
<span ng-bind-html="permittype | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>

在下拉菜单中,我只需要“国家许可证”、“安得拉邦”,但它在下拉菜单中显示为 NP、国家许可证 AP、安得拉邦。

我已经更改了我的代码以显示在“国家许可证”上,我这样做了

 <ui-select name="permit" id ="permit" multiple ng-model="vehicle.selectedPermits"  on-select="getVehiclepermitId($item)"   ng-disabled="disabled" class="w-md mb-10">
<ui-select-match placeholder="Select or search a Permit Type in the list...">{{$item[1]}}</ui-select-match>
<ui-select-choices repeat="permittype in vehPermitTypevalue[index][1] track by $index | filter:$select.search">
<span ng-bind-html="permittype | highlight: $select.search"></span>
</ui-select-choices>

然后无法在下拉列表中显示任何项目。

选择任何选项后,它会正确显示,如“国家许可”,带有“X”标记以删除我做了{{$item 1 }}。

我附上照片

enter image description here

选择后我会因为{{$item 1 }}

enter image description here

最佳答案

试试这个

<ui-select-choices repeat="permittype in vehPermitTypevalue track by $index | filter:$select.search">
<span ng-bind-html="permittype[1] | highlight: $select.search"></span>
</ui-select-choices>

关于javascript - 二维数组的 ng-repeat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41518970/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com