Explorar el Código

[add]

檀家編集画面で保存すると詳細ページに遷移する処理。
檀家編集画面でキャンセルすると詳細ページに遷移する処理
poohr hace 1 mes
padre
commit
5b1d7b5735

+ 1
- 1
src/app/pages/danka-edit/danka-edit.html Ver fichero

118
             削除
118
             削除
119
           </button>
119
           </button>
120
 
120
 
121
-          <button type="button" class="cancel-button">
121
+          <button type="button" class="cancel-button" [routerLink]="['/danka-detail', danka?.id]">
122
             キャンセル
122
             キャンセル
123
           </button>
123
           </button>
124
 
124
 

+ 4
- 2
src/app/pages/danka-edit/danka-edit.ts Ver fichero

7
   ReactiveFormsModule,
7
   ReactiveFormsModule,
8
   Validators,
8
   Validators,
9
 } from '@angular/forms';
9
 } from '@angular/forms';
10
-import { ActivatedRoute } from '@angular/router';
10
+import { ActivatedRoute, Router, RouterLink } from '@angular/router';
11
 import { AppHeader } from '../../share/header/app-header';
11
 import { AppHeader } from '../../share/header/app-header';
12
 import { AppSideMenu } from '../../share/side-menu/app-side-menu';
12
 import { AppSideMenu } from '../../share/side-menu/app-side-menu';
13
 import { DankaService } from '../../services/dankaService';
13
 import { DankaService } from '../../services/dankaService';
15
 
15
 
16
 @Component({
16
 @Component({
17
   selector: 'app-danka-edit',
17
   selector: 'app-danka-edit',
18
-  imports: [AppHeader, AppSideMenu, ReactiveFormsModule],
18
+  imports: [AppHeader, AppSideMenu, ReactiveFormsModule, RouterLink],
19
   templateUrl: './danka-edit.html',
19
   templateUrl: './danka-edit.html',
20
   styleUrl: './danka-edit.scss',
20
   styleUrl: './danka-edit.scss',
21
 })
21
 })
37
   constructor(
37
   constructor(
38
     private dankaService: DankaService,
38
     private dankaService: DankaService,
39
     private route: ActivatedRoute,
39
     private route: ActivatedRoute,
40
+    private router: Router,
40
   ) {
41
   ) {
41
     const id = this.route.snapshot.params['id'];
42
     const id = this.route.snapshot.params['id'];
42
     if (id) {
43
     if (id) {
99
     };
100
     };
100
 
101
 
101
     this.dankaService.saveDanka(updatedDanka);
102
     this.dankaService.saveDanka(updatedDanka);
103
+    this.router.navigate(['./danka-detail', this.danka.id]);
102
     console.log(this.dankaService.getDankaList());
104
     console.log(this.dankaService.getDankaList());
103
   }
105
   }
104
 }
106
 }

Loading…
Cancelar
Guardar