diff --git a/application/application-common.ts b/application/application-common.ts index 621b285e2..b1e97ef97 100644 --- a/application/application-common.ts +++ b/application/application-common.ts @@ -6,6 +6,8 @@ import styleScope = require("ui/styling/style-scope"); export var cssFile: string = "app.css" +export var resources: any = {}; + export var onUncaughtError: (error: definition.NativeScriptError) => void = undefined; export var onLaunch: (context: any) => any = undefined; diff --git a/application/application.d.ts b/application/application.d.ts index d3bc21a27..5f736b23d 100644 --- a/application/application.d.ts +++ b/application/application.d.ts @@ -23,6 +23,11 @@ declare module "application" { */ export var mainModule: string; + /** + * An application level static resources. + */ + export var resources: any; + /** * The application level css file name (starting from the application root). Used to set css across all pages. * Css will be applied for every page and page css will be applied after. diff --git a/apps/tests/ui/list-view/list-view-tests.ts b/apps/tests/ui/list-view/list-view-tests.ts index b804ce587..23b65a6de 100644 --- a/apps/tests/ui/list-view/list-view-tests.ts +++ b/apps/tests/ui/list-view/list-view-tests.ts @@ -429,6 +429,38 @@ export function test_loadMoreItems_not_raised_when_showing_many_items() { helper.buildUIAndRunTest(listView, testAction); } +export function test_usingAppLevelConvertersInListViewItems() { + var listView = new listViewModule.ListView(); + + var dateConverter = function (value, format) { + var result = format; + var day = value.getDate(); + result = result.replace("DD", month < 10 ? "0" + day : day); + var month = value.getMonth() + 1; + result = result.replace("MM", month < 10 ? "0" + month : month); + result = result.replace("YYYY", value.getFullYear()); + return result; + }; + + app.resources["dateConverter"] = dateConverter; + + var data = new observableArray.ObservableArray(); + + data.push({date: new Date()}); + + function testAction(views: Array) { + listView.itemTemplate = "