I’m using Angular v12 and Capacitor v3 without Ionic. I’m trying to get the name of the active parent component. I’m using this code in the app.component.html:
<router-outlet (activate)="onActivate($event)"></router-outlet>
Then, in the app.component.ts I’m using the onActivate function like this:
onActivate(event: any) {
alert(event.constructor.name);
}
In a web browser it alerts correctly with the active component name, but in an emulator or on my cell it alerts the letter e.
When I alerted event.constructor on my cell it shows the class name is ‘e’ and not the component name.
Is there a way of using Angular and Capacitor without Ionic to get the name of the active component?
Thanks for reading!
1 post - 1 participant