I've set up my routing as follows:
const pages = [
{
path: "",
component: BaseComponent,
children: [
{ path: "scan", component: ScanComponent }
]
}
];
So for example, if you go to /scan, it involves BaseComponent and ScanComponent.
The BaseComponent contains a <router-outlet></router-outlet> which renders the contents of the ScanComponent.
This all works fine, However:
In ScanComponent I have the following:
constructor(private page: Page) {
this.page.on('navigatedTo', () => console.log('navigatedTo'));
}
And this event is never called.
If I remove the line component: BaseComponent from the parent route, the event is called, but that of course breaks other things.
How can I make sure this event is always called, regardless of whether there's a parent component or not?
This is a NativeScript application where the root component contains <page-router-outlet></page-router-outlet>