Angular 2 EventEmitter invokes all non-nested components

I have 2 components with one nested component in each. The nested component has an EventEmitter that runs the method of the parent component

<parent1>
    <nested (changed)="onChanged1($event)"></nested>
</parent2>
<parent2>
    <nested (changed)="onChanged2($event)"></nested>
</parent2>

onChanged1 and onChanged2 after each "modified" emit.

in onChanged2 I have event data from the 'modified' eventEmitter from parent1!

Please give advice on how to avoid this problem.

+4
source share

Source: https://habr.com/ru/post/1679050/


All Articles