Set app title & version in app.js instead of ListCtrl
Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/5eaa8cbe Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/5eaa8cbe Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/5eaa8cbe Branch: refs/heads/master Commit: 5eaa8cbe741c4f0fb2a5873bc3d34153973b97ad Parents: 54781c3 Author: Andrew Grieve <[email protected]> Authored: Wed May 28 17:07:35 2014 -0400 Committer: Andrew Grieve <[email protected]> Committed: Wed May 28 17:07:35 2014 -0400 ---------------------------------------------------------------------- www/cdvah/harnessmenu.html | 2 +- www/cdvah/js/ListCtrl.js | 4 +--- www/cdvah/js/app.js | 6 ++++++ 3 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/5eaa8cbe/www/cdvah/harnessmenu.html ---------------------------------------------------------------------- diff --git a/www/cdvah/harnessmenu.html b/www/cdvah/harnessmenu.html index 4636d26..48e2a4b 100644 --- a/www/cdvah/harnessmenu.html +++ b/www/cdvah/harnessmenu.html @@ -44,7 +44,7 @@ <body> <div class="topcoat-navigation-bar"> <div class="topcoat-navigation-bar__item center full"> - <h1 class="topcoat-navigation-bar__title">{{ appTitle }}</h1> + <h1 class="topcoat-navigation-bar__title">{{ appTitle }} v{{ appVersion }}</h1> </div> </div> http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/5eaa8cbe/www/cdvah/js/ListCtrl.js ---------------------------------------------------------------------- diff --git a/www/cdvah/js/ListCtrl.js b/www/cdvah/js/ListCtrl.js index 1dc38cc..f402e6d 100644 --- a/www/cdvah/js/ListCtrl.js +++ b/www/cdvah/js/ListCtrl.js @@ -19,10 +19,8 @@ (function(){ 'use strict'; /* global myApp */ - myApp.controller('ListCtrl', ['$location', 'notifier', '$rootScope', '$scope', '$routeParams', '$q', 'AppsService', 'HarnessServer', 'APP_NAME', 'APP_VERSION', function ($location, notifier, $rootScope, $scope, $routeParams, $q, AppsService, HarnessServer, APP_NAME, APP_VERSION) { + myApp.controller('ListCtrl', ['$location', 'notifier', '$scope', '$routeParams', '$q', 'AppsService', 'HarnessServer', function ($location, notifier, $scope, $routeParams, $q, AppsService, HarnessServer) { $scope.appList = []; - $rootScope.appTitle = APP_NAME + ' v' + APP_VERSION; - document.title = APP_NAME + ' v' + APP_VERSION; function initialise() { $scope.$on('$destroy', function() { http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/5eaa8cbe/www/cdvah/js/app.js ---------------------------------------------------------------------- diff --git a/www/cdvah/js/app.js b/www/cdvah/js/app.js index 864398b..8b84a1a 100644 --- a/www/cdvah/js/app.js +++ b/www/cdvah/js/app.js @@ -33,6 +33,12 @@ myApp.config(['$routeProvider', function($routeProvider){ }); }]); +myApp.run(['$rootScope', 'APP_NAME', 'APP_VERSION', function($rootScope, APP_NAME, APP_VERSION){ + $rootScope.appTitle = APP_NAME; + $rootScope.appVersion = APP_VERSION; + document.title = APP_NAME + ' v' + APP_VERSION; +}]); + document.addEventListener('deviceready', function() { myApp.value('INSTALL_DIRECTORY', cordova.file.dataDirectory + 'apps/'); myApp.value('APPS_JSON', cordova.file.dataDirectory + 'apps.json');
