How to display feedback/toast when navigating pages


#1

Hi!

I want to display a feedback/toast whenever I navigate a page, where will I put the function?
Will I place it in the main-page.js or in the view-model?

sample codes would be much appreciated :slight_smile:

Thanks!


#2

main-page.xml:

<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="navigatedTo">
...
</Page>

main-page.ts:

import { EventData } from "tns-core-modules/data/observable";

export function navigatedTo(args: EventData): void {
    // feedback goes here
}