Skip to content

Commit bb48cde

Browse files
committed
Merge pull request #981 from dciccale/splice_no_iteration
chore(admin): splice user without iteration
2 parents af69a68 + 366d032 commit bb48cde

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Diff for: app/templates/client/app/admin(auth)/admin.controller(coffee).coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ angular.module '<%= scriptAppName %>'
99

1010
$scope.delete = (user) ->
1111
User.remove id: user._id
12-
_.remove $scope.users, user
12+
$scope.users.splice @$index, 1

Diff for: app/templates/client/app/admin(auth)/admin.controller(js).js

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ angular.module('<%= scriptAppName %>')
88

99
$scope.delete = function(user) {
1010
User.remove({ id: user._id });
11-
angular.forEach($scope.users, function(u, i) {
12-
if (u === user) {
13-
$scope.users.splice(i, 1);
14-
}
15-
});
11+
$scope.users.splice(this.$index, 1);
1612
};
1713
});

0 commit comments

Comments
 (0)