Przeglądaj źródła

[add]

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

+ 1
- 1
src/app/pages/danka-edit/danka-edit.html Wyświetl plik

@@ -118,7 +118,7 @@
118 118
             削除
119 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 123
           </button>
124 124
 

+ 4
- 2
src/app/pages/danka-edit/danka-edit.ts Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz