Advertisement
Guest User

Untitled

a guest
Dec 26th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. /*@ngInject*/
  2. constructor(User, Auth, $state, $uibModal, $scope) {
  3. this.Auth = Auth;
  4. this.$state = $state;
  5. this.$uibModal = $uibModal;
  6. this.$scope = $scope;
  7.  
  8. this.newUser = {name: "New User", email: "newUser@gmail.com", password: "gg"};
  9. this.users = User.query();
  10. this.users.push(this.newUser);
  11. console.log(this.users);
  12.  
  13. this.$scope.$watch('this.user', function(newUser) {
  14. console.log("entered watch");
  15. var val = this.users.indexOf(newUser);
  16. if(val == this.users.length - 1 ) {
  17. this.openNewUser();
  18. }
  19. });
  20.  
  21. }
  22.  
  23. //First get the users
  24. this.users = User.query();
  25. this.users.$promise.then(function(){
  26. //Do stuff with the user list
  27. this.users.push(this.newUser);
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement