@@ -30,6 +30,7 @@ export class CaseEditComponent implements OnInit, OnDestroy {
3030 isSaveClicked = false ;
3131
3232 spinnerStatus = false ;
33+ reverseRoute : string ;
3334
3435 constructor ( private activateRoute : ActivatedRoute ,
3536 private casesService : CasesService ,
@@ -39,6 +40,9 @@ export class CaseEditComponent implements OnInit, OnDestroy {
3940 this . id = + params [ 'id' ] ;
4041 this . templateId = + params [ 'templateId' ] ;
4142 } ) ;
43+ this . activateRoute . queryParams . subscribe ( params => {
44+ this . reverseRoute = params [ 'reverseRoute' ] ;
45+ } ) ;
4246 }
4347
4448 ngOnInit ( ) {
@@ -77,7 +81,11 @@ export class CaseEditComponent implements OnInit, OnDestroy {
7781 this . spinnerStatus = false ;
7882 this . isNoSaveExitAllowed = true ;
7983 if ( this . isSaveClicked ) {
80- this . router . navigate ( [ '/cases/' , this . currentTemplate . id ] ) . then ( ) ;
84+ if ( ! this . reverseRoute ) {
85+ this . router . navigate ( [ '/cases/' , this . currentTemplate . id ] ) . then ( ) ;
86+ } else {
87+ this . router . navigate ( [ this . reverseRoute ] ) ;
88+ }
8189 }
8290 }
8391 this . spinnerStatus = false ;
@@ -107,6 +115,7 @@ export class CaseEditComponent implements OnInit, OnDestroy {
107115 this . saveCase ( ) ;
108116 } else {
109117 this . isNoSaveExitAllowed = true ;
118+ this . router . navigate ( [ this . reverseRoute ] ) . then ( ) ;
110119 }
111120 }
112121
0 commit comments