観測可能なコレクションに結合できないNGXデータテーブル6.3を使用しています。 Angular Observable Collectionを通常の観測不可能な配列に変換するにはどうすればよいですか?ここで変換角度2観測不可観測不可
は、私がサービスのために持っているものである:ここでは
private _productUrl = '../../api/todos/todos.json';
constructor(private _http: Http) { }
getToDos(): Observable<IToDo[]> {
return this._http.get(this._productUrl)
.map((response: Response) => <IToDo[]> response.json())
.do(data => console.log('All: ' + JSON.stringify(data)))
.catch(this.handleError);
}
は、私がcomponent.tsのために持っているものです。それは私にforeachループ上のエラーを与える:は、プロパティを読み取ることができません未定義
ngOnInit() {
this._toDoService.getToDos()
.subscribe(
toDos => this.toDos = toDos,
error => this.errorMessage = <any>error);
this.rows = this.transform(this.toDos);
}
transform(source: IToDo[]): IToDo[] {
let dest: IToDo[] = [];
for (let sourceItem of source)
{
let destItem: IToDo = {
toDoId: sourceItem.toDoId,
name: sourceItem.name,
priority: sourceItem.priority,
dueDate: sourceItem.dueDate,
completed: sourceItem.completed
};
dest.push(destItem);
}
return dest;
}
ダビデ、親切な提案に感謝します。私はまずそれを試しましたが、何らかの理由でそれがバインディングで動作しませんでした。 https://github.com/swimlane/ngx-datatable/issues/373 –