Skip to content

Commit 708f072

Browse files
committed
feat(user-management): use the User $resource to populate users for the admin page
Changes: - use User.query() in admin.controller instead of $http
1 parent 4000c4a commit 708f072

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

app/templates/client/app/admin(auth)/admin.controller(coffee).coffee

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
angular.module '<%= scriptAppName %>'
44
.controller 'AdminCtrl', ($scope, $http, Auth, User) ->
55

6-
$http.get '/api/users'
7-
.success (users) ->
8-
$scope.users = users
6+
# Use the User $resource to fetch all users
7+
$scope.users = User.query()
98

109
$scope.delete = (user) ->
1110
User.remove id: user._id

app/templates/client/app/admin(auth)/admin.controller(js).js

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
angular.module('<%= scriptAppName %>')
44
.controller('AdminCtrl', function ($scope, $http, Auth, User) {
55

6-
$http.get('/api/users').success(function(users) {
7-
$scope.users = users;
8-
});
6+
// Use the User $resource to fetch all users
7+
$scope.users = User.query();
98

109
$scope.delete = function(user) {
1110
User.remove({ id: user._id });

0 commit comments

Comments
 (0)