如何在垫表DataSorce中使用NGXS

时间:2018-09-21 19:14:12

标签: angular material ngxs

我经常尝试将ngxs状态管理模式与角形材料表一起使用,但我不知道该怎么做...有人可以帮忙吗?

  export class JobsComponent implements OnInit {
 public  dataSource = new JobsDataSource(this.jobsServise);
 //@Select(HomeState.jobs) public jobs$: Observable<boolean>
  displayedColumns = ['number', 'date', 'mawb', 'origin', 'destination', 'other'];
  constructor(
    private jobsServise: JobsService,
    private store: Store) {

   }
  ngOnInit() {
   // this.store.dispatch( new GetJobs());
  }
}

export class JobsDataSource extends DataSource <any> {
  public jobs: IJobs[];

  constructor(private jobsServise: JobsService){
    super();
  }
  public connect(): Observable<IJobs[]>{
   return this.jobsServise.getJobs();
  }
  public disconnect(){}
}

0 个答案:

没有答案