I'm looking for a solution to redirect/stay on the CREATE_PAGE in Angular/TypeScript when inserting a new item. I've tried using window.open and href functions without success. If you have any suggestions, please share them :)
private onSaveSuccess(result: WorkingOrderItems) {
// this.spinner.hide();
this.isSaving = false;
console.log('IN ON SUCCESS');
if (this.isCreatePage) {
console.log('IS CREATE');
// this.workingOrderItemsService.loadWorkingOrderItemsPageEmitter.emit({ id: result.id, shouldRouteToDetails: false });
this.workingOrderItemsService.changeSelectedWorkingOrderItemsEmitter.emit();
this.workingOrderItemsService.changePageTypeEmitter.emit(CREATE_PAGE);
// this.workingOrderItems = {};
location.reload()
window.open('working-order-items-create')
} else {
console.log('NOT CREATE');
this.workingOrderItemsService.loadWorkingOrderItemsPageEmitter.emit(result.id);
this.router.navigate([this.rootRoute], {
queryParams: {
activeTab: this.tabName,
tabMode: DETAILS_PAGE,
id: result.id
}
});
}
this.spinner.hide();
}