I have a parent component which calls another component which renders the modal on the same page. On first load parent component is able to pass the data to child component. but once i go to another page and comes back then data from parent is not getting bound to child components modal.
Steps to follow in plunker:-
Plunker:- https://plnkr.co/edit/GNPyL6DzzxCzUD8VZMRF?p=preview
{
import {Component,AfterViewInit} from '@angular/core'
@Component({
selector: 'revel2',
inputs: ['value']
template: `
<div id="myModal2" class="small reveal" data-reveal aria-hidden="true" role="dialog">
I am Modal2 and I got value from parent component as:-
{{value}}
</div>`
})
export class ModalComponent2 {
value:string;
ngAfterViewInit(): void {
$('#myModal2').foundation();
$(window).trigger('open.fndtn.reveal');
}
}
}