Advertisement
Guest User

Untitled

a guest
Mar 20th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 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. for (var i = 0; i < $scope.users.length; i++)
  22. {
  23. if($scope.checkBox == true)
  24. {
  25. $scope.users.splice(i, 1);
  26. clearBoxes();
  27. }
  28. }
  29. }
  30.  
  31. function clearUser() {
  32. $scope.e = {};
  33. $scope.e.users = $scope.users[0];
  34. $scope.newUser = false;
  35. }
  36.  
  37. function clearBoxes() {
  38. $scope.checkBox = {};
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement