Guest User

Untitled

a guest
Mar 20th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. getAccount() {
  2. this.accounts.getAccount(this.accountId).subscribe(
  3. response => {
  4. this.accountView = this.apiHandler.responseHandler(response);
  5. this.accountCompare = this.apiHandler.responseHandler(response);
  6. console.log(this.accountCompare);
  7. },
  8. (err) => {
  9. this.apiHandler.errorHandler(err);
  10. }
  11. );
  12. }
  13.  
  14. //then in this function, I filter accountView, however it appears to also be affecting accountCompare as well.
  15.  
  16. userDelete(id) {
  17. if (this.accountCompare.users.some(item => item.id === id)) {
  18. this.accountForm.value.usersToDelete.push(id);
  19. }
  20. this.accountView.users = this.accountView.users.filter(user => user.id !== id);
  21. /* this.accountForm.value.usersToAdd = this.accountForm.value.usersToAdd.filter(user => id !== id); */
  22. console.log(this.accountCompare);
  23.  
  24. }
Add Comment
Please, Sign In to add comment