TwoToc code
[YouAndWeb_TwoToc] / client / app / admin / admin.controller.js
1 'use strict';
2
3 angular.module('dashboardApp')
4   .controller('AdminCtrl', function($scope, $http, Auth, User) {
5
6     // Use the User $resource to fetch all users
7     $scope.users = User.query();
8
9     $scope.delete = function(user) {
10       User.remove({ id: user._id });
11       $scope.users.splice(this.$index, 1);
12     };
13
14     $scope.user = {};
15
16     $scope.create = function(user) {
17         User.save(user);
18         $scope.users.push(user);
19     };
20   });