I am struggling with something i think is pretty straight forward. Essentially i have an angular 8 application and am using ngrx. All my CRUD operations are working but i want to navigate to a url after successfully completing and add or update.
When i step through the code everything works except triggering the change on return from the observable, I have tried two different approaches and both seem to return from the observable but will not complete the next step.
The actual update or add to record in firestore and my ngrx and ngrx/data store works perfectly the only thing not working is the instruction i supply after completing those activities
For simplification i have just added a console log statement instead a routing action. When i debug i get back to the subscribe or tap operator but it does not seem to execute the instruction inside that method and does not return any errors.
Product Component
1st Approach
this._entityService.add(entity).subscribe(() => console.log('added record'));
2nd Approach
this._entityService.add(entity).pipe(
tap(() => {
console.log('added record');
})
);
Entity Service
add(entity): Observable<any> {
return Observable.create(observer =>
this.firestoreService.createDoc(`products/`, entity)
);
}