gpt4 book ai didi

AngularJs ng-repeat with index

转载 作者:行者123 更新时间:2023-12-04 22:19:42 25 4
gpt4 key购买 nike

我只想在单击显示按钮时在此部分中显示名称。我正在尝试使用索引进行检测,但没有成功。
Code :

<div ng-repeat="c in customers">

<a ng-click="display(c.id[$index])" ng-hide="need to hide after click this one">{{vm.updateText}}</a>
<div ng-show="c.id[$index]" class="updateSection">
<input type="text" name="id" data-ng-model="id" />
<input type="button" ng-click="vm.veryId(id)" value="{{vm.verifyButtonText}}">
<input type="button" ng-click="vm.Cancel()" value="{{vm.cancelButtonText}}">
</div>
</div>
// will show ng-click="vm.veryId(id)"
<rpe-progress data-ng-show="vm.showProgress" block="true"></rpe-progress>
// if id is working will show following error message:
<rpe-alert show="vm.mpnIdAlert">{{vm.errormessage}}</rpe-alert>



<script>
vm.display= function (index) {
vm.id[index] = true;
// I want show updatesection & hide Update text
}
vm.cancel= function () {
// I want hide updatesection & show Update text
}


vm.veryId= function (id) {
// If id is wrong show error message.
}
</script>

最佳答案

如果我正确理解你的问题,你应该使用 track by

举个例子:

<div ng-repeat="n in [42, 42, 43, 43] track by $index">
{{n}}
<p ng-show="$index === 3">Index is 3</p>
</div>

https://docs.angularjs.org/api/ng/directive/ngRepeat

关于AngularJs ng-repeat with index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35808005/

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