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

151
Vistas
Angular material table using ngrx

I use ngrx to display and update and delete elements in my table that comes from angular material, for that I have a get and add and delete method that works very well but the problem is that every time I delete my table does not update I am forced to refresh my page.

I could very well import the get method into the delete method but I would like to do otherwise.

thanks you.

ts.file

export class AppComponent implements OnInit, OnDestroy {

  public myUserSub!: Subscription;
  private ELEMENT_DATA!: PeriodicElement[];
  public displayedColumns: string[] = ['name'];
  public dataSource = new MatTableDataSource(this.ELEMENT_DATA);

  constructor(private store: Store<reducer.State>) {

    store.select(tableSelector.selectAll).subscribe((t) => {
      this.dataSource.data = t;
    });
  }

  ngOnInit(): void {
    this.storeSelect();
    this.get();
  }

  storeSelect() {
    this.myUserSub = this.store.select(tableSelector.selectAll).subscribe((res) => {
      console.log(res);
    });
  }

  get() {
    this.store.dispatch({ type: action.ActionTypes.GetAll });
  }

  add(name: any) {
    this.store.dispatch({type: action.ActionTypes.preAdd, payload: { name: name }});
  }

  delete(row: number) {
    this.store.dispatch({type: action.ActionTypes.preDelete, payload: { id: row }});
  }
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