From 54af895b244d73bb16efa14961cd4b09e812a1ac Mon Sep 17 00:00:00 2001
From: DESKTOP-HBB3MIJ\myHR <nattapat.aot7735@gmail.com>
Date: Mon, 23 Dec 2024 11:39:38 +0700
Subject: [PATCH] บังคับให้อัปเดต View ตอนเปิด Modal หน้า ทะเบียนส่วน ,ส่วนย่อย 2

---
 src/app/components/company-registration/branch-business-unit/section-registration/section-registration.component.ts | 6 ++++--
 src/app/components/company-registration/branch-business-unit/sub-department-two/sub-department-two.component.ts     | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/app/components/company-registration/branch-business-unit/section-registration/section-registration.component.ts b/src/app/components/company-registration/branch-business-unit/section-registration/section-registration.component.ts
index 3e60e07..18e7184 100644
--- a/src/app/components/company-registration/branch-business-unit/section-registration/section-registration.component.ts
+++ b/src/app/components/company-registration/branch-business-unit/section-registration/section-registration.component.ts
@@ -1,4 +1,4 @@
-import { Component, EventEmitter, Input, OnInit, } from '@angular/core';
+import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, } from '@angular/core';
 import { ToastrService } from 'ngx-toastr';
 import { Bu2Model, MyBu2Model } from 'src/app/shared/model/bu2.model';
 import { Bu3Model, MyBu3Model } from 'src/app/shared/model/bu3.model';
@@ -37,7 +37,8 @@ export class SectionRegistrationComponent implements OnInit {
   currentModal = ""
   constructor(private bu3Service: Bu3Service,
     private bu2Service: Bu2Service,
-    private toastr: ToastrService
+    private toastr: ToastrService,
+    private cdr: ChangeDetectorRef
   ) { }
   ngOnInit(): void {
     this.getBu3List()
@@ -64,6 +65,7 @@ export class SectionRegistrationComponent implements OnInit {
     if (this.bu3.parent) {
       this.bu2Service.getById(this.bu3.parent).subscribe(response => {
         this.bu2 = new MyBu2Model(response)
+        this.cdr.detectChanges()
       })
     }
   }
diff --git a/src/app/components/company-registration/branch-business-unit/sub-department-two/sub-department-two.component.ts b/src/app/components/company-registration/branch-business-unit/sub-department-two/sub-department-two.component.ts
index 7395c4e..0042318 100644
--- a/src/app/components/company-registration/branch-business-unit/sub-department-two/sub-department-two.component.ts
+++ b/src/app/components/company-registration/branch-business-unit/sub-department-two/sub-department-two.component.ts
@@ -1,4 +1,4 @@
-import { Component, EventEmitter, Input, OnInit, } from '@angular/core';
+import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, } from '@angular/core';
 import { ToastrService } from 'ngx-toastr';
 import { Bu4Model, MyBu4Model } from 'src/app/shared/model/bu4.model';
 import { Bu5Model, MyBu5Model } from 'src/app/shared/model/bu5.model';
@@ -37,7 +37,8 @@ export class SubDepartmentTwoComponent implements OnInit {
   currentModal = ""
   constructor(private bu5Service: Bu5Service,
     private bu4Service: Bu4Service,
-    private toastr: ToastrService
+    private toastr: ToastrService,
+    private cdr: ChangeDetectorRef
   ) { }
   ngOnInit(): void {
     this.getBu5List()
@@ -64,6 +65,7 @@ export class SubDepartmentTwoComponent implements OnInit {
     if (this.bu5.parent) {
       this.bu4Service.getById(this.bu5.parent).subscribe(response => {
         this.bu4 = new MyBu4Model(response)
+        this.cdr.detectChanges()
       })
     }
   }
--
libgit2 0.26.0