// Ionic Starter App // angular.module is a global place for creating, registering and retrieving Angular modules // 'starter' is the name of this angular module example (also set in a attribute in index.html) // the 2nd parameter is an array of 'requires' // 'starter.controllers' is found in controllers.js angular.module('starter', ['ionic', 'starter.controllers', 'pascalprecht.translate']) .run(function($ionicPlatform) { $ionicPlatform.ready(function() { // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard // for form inputs) if (window.cordova && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.disableScroll(true); } if (window.StatusBar) { // org.apache.cordova.statusbar required StatusBar.styleDefault(); } }); }) .config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('app', { url: '/app', abstract: true, templateUrl: 'templates/menu.html', controller: 'AppCtrl' }) .state('app.settings', { url: '/settings', views: { 'menuContent': { templateUrl: 'templates/settings.html', controller: 'SettingsCtrl' } } }) .state('app.help', { url: '/help', views: { 'menuContent': { templateUrl: 'templates/help.html', controller: 'HelpCtrl' } } }) .state('app.users', { url: '/users', views: { 'menuContent': { templateUrl: 'templates/users.html', controller: 'UsersCtrl' } } }) .state('app.user', { url: '/users/:username', views: { 'menuContent': { templateUrl: 'templates/user.html', controller: 'UserCtrl' } } }) .state('app.travels', { url: '/travels', views: { 'menuContent': { templateUrl: 'templates/travels.html', controller: 'TravelsCtrl' } } }) .state('app.travel', { url: '/travels/:travelId', views: { 'menuContent': { templateUrl: 'templates/travel.html', controller: 'TravelCtrl' } } }); // if none of the above states are matched, use this as the fallback $urlRouterProvider.otherwise('/app/travels'); }) /* translator */ .config(['$translateProvider',function($translateProvider) { /* get lang from the file translations.js */ for(lang in translations){ $translateProvider.translations(lang, translations[lang]); } if(window.localStorage.getItem('lang')) { $translateProvider.preferredLanguage(window.localStorage.getItem('lang')); }else{ $translateProvider.preferredLanguage('english'); }; $translateProvider.useSanitizeValueStrategy('escape'); }]);