Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular ng2智能表在源更改后未重新命名_Angular_Ng2 Smart Table - Fatal编程技术网

Angular ng2智能表在源更改后未重新命名

Angular ng2智能表在源更改后未重新命名,angular,ng2-smart-table,Angular,Ng2 Smart Table,这看起来很常见。但这几天我都在面对这个问题 我正在使用ng2智能表,它正在使用RESTAPI中的数据进行更新。在异步调用后首次加载数据 然而,在另一个组件中的事件发生后,在发出后,我可以看到调用了相同的方法,正在为同一个表提取数据,但这次没有使用新数据重新呈现表。有人能帮我吗 我正在使用的代码片段如下所示用于重新加载数据表 private getQuestions() { this._questionService.getAll().subscribe(data =>

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

我正在使用ng2智能表,它正在使用RESTAPI中的数据进行更新。在异步调用后首次加载数据

然而,在另一个组件中的事件发生后,在发出后,我可以看到调用了相同的方法,正在为同一个表提取数据,但这次没有使用新数据重新呈现表。有人能帮我吗

我正在使用的代码片段如下所示用于重新加载数据表

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));
  }

每次加载数据时都必须清除源。最有可能的是它被追加了。

每次加载数据时,您都必须清除源。最有可能的是它被附加了