Last active
March 23, 2016 19:54
-
-
Save gabouh/d64c07222cbae513caee to your computer and use it in GitHub Desktop.
Get Item element text and use it as title in the next page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scrollView = new scrollViewModule.ScrollView(); | |
var myItems = [ | |
{ name: "Different Item One" }, | |
{ name: "Different Item Two" } | |
]; | |
var bindingContext; | |
exports.loaded = function(args) { | |
var page = args.object; | |
bindingContext = page.navigationContext; | |
console.log('bindingContext'); | |
console.dir(bindingContext); | |
var topmost = frameModule.topmost().navigatingTo; | |
console.log('topmost'); | |
console.log(topmost); | |
// console.log('bindingContextACAAA'); | |
// var title = bindingContext.title; | |
// console.log(title); | |
page.bindingContext = { bindingContext,scrollView,myItems:myItems }; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<page loaded="loaded" xmlns="http://schemas.nativescript.org/tns.xsd"> | |
<Page.actionBar> | |
<ActionBar title="{{ bindingContext.title }}"> | |
<ActionBar.titleView> | |
<GridLayout> | |
<Label text="{{ bindingContext.title }}" horizontalAlignment="center" /> | |
</GridLayout> | |
</ActionBar.titleView> | |
</ActionBar> | |
</Page.actionBar> | |
</page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Observable = require('data/observable'); | |
var bindingContext = new Observable.Observable({ | |
title: 'Home' | |
}); | |
exports.loaded = function(args) { | |
var page = args.object; | |
page.bindingContext = bindingContext; | |
}; | |
function itemTap(args) { | |
var item = args.view.bindingContext; | |
var topmost = frameModule.topmost(); | |
// console.dir(args); | |
console.dir(item); | |
bindingContext.title = 'Item One'; | |
// console.dir(item); | |
// console.log(topmost); | |
topmost.navigate({ | |
moduleName: 'views/categories/categories', | |
context: item | |
}); | |
} | |
exports.itemTap = itemTap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<page loaded="loaded" xmlns="http://schemas.nativescript.org/tns.xsd"> | |
<StackLayout class="buttonBox" tap="itemTap"> | |
<Label class="iconSym" text="☎" /> | |
<Label class="" text="Nav Item One" /> | |
</StackLayout> | |
<StackLayout class="buttonBox" tap="itemTap"> | |
<Label class="iconSym" text="☎"/> | |
<Label class="" text="Nav Item Two"/> | |
</StackLayout> | |
</page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment