ng2-smart-table在源更改后没有重新编译

时间:2017-11-21 05:57:02

标签: angular ng2-smart-table

这看起来很常见。但我几天都面临着这个问题。

我正在使用ng2-smart-table,它正在使用来自rest API的数据进行更新。异步调用后第一次加载数据。

然而,在一个不同组件中的事件之后,在发出之后,我可以看到调用相同的方法,正在为同一个表提取数据,但是这次没有用新数据重新呈现表。可以任何人对此有所帮助?

我正在使用的代码片段,用于数据表重新加载。

private getQuestions()
  {
    this._questionService.getAll().subscribe(data => 

      {
      //this.data = data;
      //this.source.load(slice();
      this.data.load(data);
      this.data.reset();
      //this.data.update()
      this.data.refresh();
      console.log('Data length:'+this.data.count());
      this.cd.markForCheck();
      },
      error=> console.log("Error: "+error));
  }

1 个答案:

答案 0 :(得分:0)

每次加载数据时都必须清除源代码。最有可能是附加。