There is a case where the data are being sent from two different components; let's say OneComponent
and TwoComponent
and there is a ResultComponent
which receive these data via Input()
decorator. Also, in ResultComponent
the data are merged using OnChanges
interface:
ngOnChanges(changes: SimpleChanges) {
if (changes['dataFromCompTwo']) {
this.dataFromComp = this.dataFromCompTwo;
}
}
and data are shown in this component, but component is instantiated twice and the data are double. How to check if data are already sent from one of the components and show only last sent data?
STACKBLITZ => I would like to show Here is result just once.