File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,13 +38,8 @@ detection, and preventing invalid form submission.
3838 $scope.form.contacts.push({type:'', value:''});
3939 };
4040
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);
4843 };
4944
5045 $scope.isCancelDisabled = function() {
@@ -83,7 +78,7 @@ detection, and preventing invalid form submission.
8378 <option>IM</option>
8479 </select>
8580 <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> ]
8782 </div>
8883 <button ng-click="cancel()" ng-disabled="isCancelDisabled()">Cancel</button>
8984 <button ng-click="save()" ng-disabled="isSaveDisabled()">Save</button>
You can’t perform that action at this time.
0 commit comments