瀏覽代碼

[fix]

檀家一覧表の初期表示を修正
・ChangeDetectorRefをAngularのngOnInitに追加
poohr 1 周之前
父節點
當前提交
696b6510c9
共有 1 個檔案被更改,包括 5 行新增2 行删除
  1. 5
    2
      src/app/pages/danka-list/danka-list.ts

+ 5
- 2
src/app/pages/danka-list/danka-list.ts 查看文件

@@ -1,4 +1,5 @@
1
-import { Component, OnInit } from '@angular/core';
1
+import { ChangeDetectorRef, Component, OnInit, computed } from '@angular/core';
2
+import { toSignal } from '@angular/core/rxjs-interop';
2 3
 import { RouterLink } from '@angular/router';
3 4
 import { DankaService } from '../../services/dankaService';
4 5
 import { FamilyService } from '../../services/family-service';
@@ -64,6 +65,7 @@ export class DankaList implements OnInit {
64 65
   constructor(
65 66
     private dankaService: DankaService,
66 67
     private familyService: FamilyService,
68
+    private cdr: ChangeDetectorRef,
67 69
   ) {}
68 70
 
69 71
   // 非同期初期化
@@ -74,6 +76,7 @@ export class DankaList implements OnInit {
74 76
   async init(): Promise<void> {
75 77
     this.dankaList = await this.dankaService.getDankaList();
76 78
     this.showAllDanka();
79
+    this.cdr.detectChanges();
77 80
   }
78 81
 
79 82
   showAllDanka() {
@@ -158,4 +161,4 @@ export class DankaList implements OnInit {
158 161
   private normalizeName(name: string): string {
159 162
     return name.replace(/\s/g, '');
160 163
   }
161
-}
164
+}

Loading…
取消
儲存