angular - Angular2 Modal updated, but view is not updating -
created component named notification.component.ts
import { component, oninit } '@angular/core'; @component({ selector: 'notification', templateurl: './notification.component.html', styleurls: ['./notification.component.css'] }) export class notificationcomponent implements oninit { constructor() { } private type:string = ""; private message:string = ""; private showmessage:boolean = false; ngoninit() { //this.showmessagebox('info', 'hi da'); } showmessagebox = (type:string, message:string): void => { this.type = type; this.message = message; this.showmessage = true; } }
and template below
<div id="notification" class="boxshadow" *ngif="showmessage" > <b>{{type}}! </b>{{message}} </div>
i have called showmessagebox() function other component. model updated, view not updating. pfb component below
import { component, oninit, viewencapsulation, inject } '@angular/core'; import { messages } '../shared/classes/messages'; import { notificationcomponent } '../shared/notification/notification.component'; @component({ selector: 'app-estimation-gating', templateurl: './estimation-gating.component.html', styleurls: ['./estimation-gating.component.css'] providers: [] }) export class estimationgatingcomponent implements oninit { constructor( private messages: messages, private n:notificationcomponent) { //alert(messages.gating.gating_saved); n.showmessagebox('info', messages.gating.gating_saved); } }
please me fixing issue.
Comments
Post a Comment