Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

247
Vistas
how to collect data from template and prepare post request from exact item

I am getting user data from backend and i need to change exact user information and send it to the backend, i make UI part with select and etc, so the question is:

How to collect changed data for an exact item from the template without form and prepare a post request body?

sorry if I explained badly. check the code below!

export class UsersComponent implements OnInit {

  public isLoading: boolean = true;

  public firstLoading: boolean = true;

  public langChangeObs: Observable<number | null> = this.storeService.selectedLangId;

  public users: IUserManagement[] = [];

  public roles: IRolesList[] = [];

  // @ts-ignore
  private langId: number;

  private ngUnsubscribe: Subject<void> = new Subject<void>();

  constructor(private storeService: StoreService,
              private http: HttpClientService) { }

  ngOnInit(): void {
    this.subscribeToChangeLang();
    this.getData();
  }

  private subscribeToChangeLang() {
    this.langChangeObs.pipe(
      takeUntil(this.ngUnsubscribe)
    ).subscribe(langId => {
      this.langId = langId as number;
    });
  }

  private getData() {
    this.http.getUsers(this.langId).subscribe((data: any) => {
      console.log(data);
      this.users = data.users.data;
      this.roles = data.roles.data;
    });
  }

  public sentUserChange() {
  }

  ngOnDestroy(): void {
    this.ngUnsubscribe.next();
    this.ngUnsubscribe.complete();
  }

}
<nb-card size="large">
  <nb-list>
    <nb-list-item class="users" *ngFor="let user of users">
      <div>
      <nb-user [name]="user.name">
      </nb-user>
      </div>
      <div>
        <span class="label">Email:</span>
        <input nbInput type="text" [(ngModel)]="user.email">
      </div>
      <div>
        <span class="label">Role:</span>
      <nb-select class="role-select" size="small" placeholder="{{user.role.role}}" [(selected)]="user.role.role">
        <nb-option *ngFor="let role of roles" [value]="role.id">{{role.human_readable}}</nb-option>
      </nb-select>
      </div>
      <div>
        <button click="sentUserChange()" nbButton>Save</button>
      </div>
    </nb-list-item>
  </nb-list>
</nb-card>

UI image

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda