File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -38,13 +38,8 @@ detection, and preventing invalid form submission.
38
38
$scope.form.contacts.push({type:'', value:''});
39
39
};
40
40
41
- $scope.removeContact = function(contact) {
42
- var contacts = $scope.form.contacts;
43
- for (var i = 0, ii = contacts.length; i < ii; i++) {
44
- if (contact === contacts[i]) {
45
- contacts.splice(i, 1);
46
- }
47
- }
41
+ $scope.removeContact = function(index) {
42
+ $scope.form.contacts.splice(index, 1);
48
43
};
49
44
50
45
$scope.isCancelDisabled = function() {
@@ -83,7 +78,7 @@ detection, and preventing invalid form submission.
83
78
<option>IM</option>
84
79
</select>
85
80
<input type="text" ng-model="contact.value" required/>
86
- [ <a href="" ng-click="removeContact(contact )">X</a> ]
81
+ [ <a href="" ng-click="removeContact($index )">X</a> ]
87
82
</div>
88
83
<button ng-click="cancel()" ng-disabled="isCancelDisabled()">Cancel</button>
89
84
<button ng-click="save()" ng-disabled="isSaveDisabled()">Save</button>
You can’t perform that action at this time.
0 commit comments