Guest User

Untitled

a guest
Mar 20th, 2016
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. angular.module('watchApp').controller('userController', ['$scope', function ($scope) {
  2. $scope.users = users;
  3.  
  4. clearBoxes();
  5. clearUser();
  6.  
  7. $scope.addUser = function (e) {
  8. if (e.confirmpassword === e.password)
  9. {
  10. $scope.users.push(e);
  11. clearUser();
  12. $scope.newUser = false;
  13. }
  14. else
  15. {
  16. alert("Password's don't match!")
  17. }
  18. }
  19.  
  20. $scope.removeUser = function (h) {
  21. console.log('er að keyra');
  22. if ($scope.checkBox)
  23. {
  24. $scope.users.splice(h,1);
  25. clearBoxes();
  26. }
  27. }
  28.  
  29. function clearUser() {
  30. $scope.e = {};
  31. $scope.e.users = $scope.users[0];
  32. $scope.newUser = false;
  33. }
  34.  
  35. function clearBoxes() {
  36. $scope.checkBox = {};
  37. }
  38.  
  39.  
  40.  
  41. }]);
Add Comment
Please, Sign In to add comment