Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!