1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular RxJs - Crud Operations

Discussão em 'Angular' iniciado por user11236708, Julho 8, 2025.

  1. user11236708

    user11236708 Guest

    public ngOnInit() {
    this.getUsers();
    }

    public getUsers() {
    this.userService.getUsers(this.listId).pipe(take(1)).subscribe(data => {
    if (data.result.length) {
    this.users = data.result;
    } else {
    const user = new UserModel();
    this.users = [user];
    }
    this.setupForm();
    });

    }

    public deleteUser(userId: number) {
    this.userService.delete(this.listId, userId)
    .subscribe(() => this.getUsers())
    }


    How would you recommand me, when I'm deleting an user from a table, to get back all the users? Is ok to call this.getUsers() method in .subscribe()? Or should I try to call it in .pipe()

    Continue reading...

Compartilhe esta Página