Within my Angular / Meteor app I want to use the created id from a collection insert in a meteor method in the client.
Within a client Angular component the following method exists.
onSubmit(): void {
Meteor.call('insertItem', this.item, (error, response) => {
if (error) {
...
} else {
this.ngZone.run(() => {
this.router.navigate(['/item/manage', response]);
});
}
});
}
The meteor method that's called by this method looks like following.
insertItem(newItem: Item): Observable<string> {
return Items.insert(newItem);
}
I want to use the id that's returned after the insert. This id is an Observable, but the response in the meteor method call doesn't recognize it as an Observable.
In what way can I return the Id to the client and use it within a router navigate?