I have getting data from PouchDB
getTodos(): Observable<any> {
return Observable.from(
this.db.allDocs({include_docs: true}).then((result) => {
if(this.data) return this.data;
this.data = [];
result.rows.map((row) => {
this.data.push(row.doc);
});
this.db.changes({live: true, since: 'now', include_docs: true}).on('change', (change) => {
this.handleChange(change);
});
return this.data;
})
);
}
And i have an intermediate service to filter this data
getFilteredTodos() {
return this.todoDb.getTodos()
.map(res => {
return res.filter(item => item.title == '1' );
});
}
And the home page where i subscribe on this data and show the result
ionViewDidLoad() {
this.filteredTodo.getFilteredTodos()
.subscribe(res => {
this.todos = res;
});
}
So, after clicking on remove button nothing has change
But if i will not filter data everything will be good, ui refreshes…
getFilteredTodos() {
return this.todoDb.getTodos()
.map(res => {
return res;
});
}