I have a read function that returns a Subject, I subscribe and get a list of all entries in the component, but after the create method, I need to reload the page to see the changes, how can I update the list in the component without reloading the page? component:
ngOnInit(): void {
this._bs.read({}).subscribe((birds: Bird) => {
this.birds = birds
})
service:
create(doc: Document = this.new()): Subject<Document> {
if (Object(doc)._id && Object(doc).keys.indexOf(this._id) === -1) {
return this.update(doc);
}
else {
const sub = this._http.post(this._url + '/create', doc);
this._reads.push(sub)
return sub;
}
}
read(opts: CrudOptions = {} as CrudOptions): any {
const sub = this._http.get(this._url + '/get');
return sub;
}