This repository was archived by the owner on Aug 7, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathmain-page.ios.ts
More file actions
37 lines (31 loc) · 1.39 KB
/
main-page.ios.ts
File metadata and controls
37 lines (31 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
In NativeScript, a file with the same name as an XML file is known as
a code-behind file. The code-behind is a great place to place your view
logic, and to set up your page’s data binding.
*/
import { EventData, Page, Label, Frame } from '@nativescript/core';
import { HelloWorldModel } from './main-view-model';
// Event handler for Page "navigatingTo" event attached in main-page.xml
export function onNavigatingTo(args: EventData) {
/*
This gets a reference this page’s <Page> UI component. You can
view the API reference of the Page to see what’s available at
https://docs.nativescript.org/api-reference/classes/_ui_page_.page.html
*/
let page = <Page>args.object;
/*
A page’s bindingContext is an object that should be used to perform
data binding between XML markup and TypeScript code. Properties
on the bindingContext can be accessed using the {{ }} syntax in XML.
In this example, the {{ message }} and {{ onTap }} bindings are resolved
against the object returned by createViewModel().
You can learn more about data binding in NativeScript at
https://docs.nativescript.org/core-concepts/data-binding.
*/
page.bindingContext = new HelloWorldModel();
page.getViewById<Label>("platform").text = "ios";
}
export function goToSecondPage(args) {
var topmost = Frame.topmost();
topmost.navigate("views/second-page");
}