仅当单击显示按钮时,我想在本节中显示名称。我试图检测使用索引,但我没有得到成功。带索引的AngularJs ng-repeat
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>
我不想要使用硬代码值 - 3 – user3194721
这只是一个例子来演示如何使用 – glcheetham