我想仅在单击显示按钮时在此部分中显示名称。我正在尝试使用索引进行检测,但没有成功。
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 https://docs.angularjs.org/api/ng/directive/ngRepeat
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)