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.js
More file actions
39 lines (33 loc) · 1.42 KB
/
main-page.ios.js
File metadata and controls
39 lines (33 loc) · 1.42 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
38
39
var frameModule = require("@nativescript/core/ui/frame");
var createViewModel = require("./main-view-model").createViewModel;
function onNavigatingTo(args) {
/*
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
*/
var page = args.object;
/*
A page’s bindingContext is an object that should be used to perform
data binding between XML markup and JavaScript 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 = createViewModel();
page.getViewById("platform").text = "ios";
}
/*
Exporting a function in a NativeScript code-behind file makes it accessible
to the file’s corresponding XML file. In this case, exporting the onNavigatingTo
function here makes the navigatingTo="onNavigatingTo" binding in this page’s XML
file work.
*/
exports.onNavigatingTo = onNavigatingTo;
function goToSecondPage(args) {
var topmost = frameModule.topmost();
topmost.navigate("views/second-page");
}
exports.goToSecondPage = goToSecondPage;