Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*@ngInject*/
- constructor(User, Auth, $state, $uibModal, $scope) {
- this.Auth = Auth;
- this.$state = $state;
- this.$uibModal = $uibModal;
- this.$scope = $scope;
- this.newUser = {name: "New User", email: "newUser@gmail.com", password: "gg"};
- this.users = User.query();
- this.users.push(this.newUser);
- console.log(this.users);
- this.$scope.$watch('this.user', function(newUser) {
- console.log("entered watch");
- var val = this.users.indexOf(newUser);
- if(val == this.users.length - 1 ) {
- this.openNewUser();
- }
- });
- }
- //First get the users
- this.users = User.query();
- this.users.$promise.then(function(){
- //Do stuff with the user list
- this.users.push(this.newUser);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement