Created
January 18, 2015 22:22
-
-
Save segphault/f648f6a491a129acb22d to your computer and use it in GitHub Desktop.
Revisions
-
segphault created this gist
Jan 18, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ var application = require("application"); application.mainModule = "app/main"; application.start(); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ var http = require("http"); var Observable = require("data/observable").Observable; var ObservableArray = require("data/observable-array").ObservableArray; var listStories = new ObservableArray(); var feedUrl = "http://newsblur.com/reader/river_stories"; exports.pageLoaded = function(args) { args.object.bindingContext = { stories: listStories }; }; exports.buttonClick = function(args) { http.getJSON(feedUrl).then(function(output) { listStories.push.apply(listStories, output.stories); }); }; exports.itemClick = function(args) { console.log("CLICKED ITEM:", listStories.getItem(args.index).story_title); }; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ <Page loaded="pageLoaded"> <ScrollView> <StackPanel> <Button text="Load" click="buttonClick" /> <ListView id="listItems" itemTap="itemClick" items="{{ stories }}"> <ListView.itemTemplate> <Label id="labelItem" textWrap="true" text="{{ story_title }}" /> </ListView.itemTemplate> </ListView> </StackPanel> </ScrollView> </Page>