Starting in angular, I am faced with the following difficulty: I have to pass a data from a child routed component to a parent component.
I thought I could use @Output with a eventEmitter. But I feel like it’s not possible I also tried to use a topic that generates a change detection error (an ExpressionChangedAfterItHasBeenCheckedError).
ts of child compo :
ngOnInit(): void {
this.itemsMenu = this.rayonService.itemsMenu;
this.activatedRoute.paramMap.subscribe(params => {
let paramUrlZone = params.get('id');
if (paramUrlZone !== null) {
this.isTest = true; // pass to the parent
}
});
this.initRefForm();
}
html parent (child compo is routed...)
------------------------------------
<div class="router-container">
<router-outlet></router-outlet>
</div>
------------------------------------
I don't how to do the stuff.. Thanks for your help !