import { EventData, Page } from '@nativescript/core'; import { HelloWorldModel } from './main-view-model'; import { CartoMap } from '@nativescript-community/ui-carto/ui'; import { MapModel } from './map-view-model'; export function navigatingTo(args: EventData) { const page = args.object; // There are issues with binding the events in the xml file due to naming // conflicts with the map events (e.g. mapReady) so we use a reference to the map instead const map = page.getViewById('cartoMap'); map.bindingContext = new MapModel(map as CartoMap); page.bindingContext = new HelloWorldModel(map.bindingContext); }