Commit 87d9dc4b by Nattana Chaiyamat

บังคับให้อัปเดต View ตอนเปิดmodal

parent 66e3de01
import { Component, EventEmitter, Input, OnInit, } from '@angular/core'; import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, } from '@angular/core';
import { ToastrService } from 'ngx-toastr'; import { ToastrService } from 'ngx-toastr';
import { Bu1Model, MyBu1Model } from 'src/app/shared/model/bu1.model'; import { Bu1Model, MyBu1Model } from 'src/app/shared/model/bu1.model';
import { Bu2Model, MyBu2Model } from 'src/app/shared/model/bu2.model'; import { Bu2Model, MyBu2Model } from 'src/app/shared/model/bu2.model';
...@@ -37,7 +37,8 @@ export class DepartmentListComponent implements OnInit { ...@@ -37,7 +37,8 @@ export class DepartmentListComponent implements OnInit {
currentModal = "" currentModal = ""
constructor(private bu2Service: Bu2Service, constructor(private bu2Service: Bu2Service,
private bu1Service: Bu1Service, private bu1Service: Bu1Service,
private toastr: ToastrService private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
this.getBu2List() this.getBu2List()
...@@ -64,6 +65,7 @@ export class DepartmentListComponent implements OnInit { ...@@ -64,6 +65,7 @@ export class DepartmentListComponent implements OnInit {
if (this.bu2.parent) { if (this.bu2.parent) {
this.bu1Service.getById(this.bu2.parent).subscribe(response => { this.bu1Service.getById(this.bu2.parent).subscribe(response => {
this.bu1 = new MyBu1Model(response) this.bu1 = new MyBu1Model(response)
this.cdr.detectChanges()
}) })
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment