commonroutesApp/www/js/app.js
www/js/app.jsRaw
1// Ionic Starter App
2
3// angular.module is a global place for creating, registering and retrieving Angular modules
4// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
5// the 2nd parameter is an array of 'requires'
6// 'starter.controllers' is found in controllers.js
7angular.module('starter', ['ionic',
8 'starter.controllers',
9 'pascalprecht.translate'])
10
11.run(function($ionicPlatform) {
12 $ionicPlatform.ready(function() {
13 // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
14 // for form inputs)
15 if (window.cordova && window.cordova.plugins.Keyboard) {
16 cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
17 cordova.plugins.Keyboard.disableScroll(true);
18
19 }
20 if (window.StatusBar) {
21 // org.apache.cordova.statusbar required
22 StatusBar.styleDefault();
23 }
24 });
25})
26
27.config(function($stateProvider, $urlRouterProvider) {
28 $stateProvider
29
30 .state('app', {
31 url: '/app',
32 abstract: true,
33 templateUrl: 'templates/menu.html',
34 controller: 'AppCtrl'
35 })
36
37 .state('app.settings', {
38 url: '/settings',
39 views: {
40 'menuContent': {
41 templateUrl: 'templates/settings.html',
42 controller: 'SettingsCtrl'
43 }
44 }
45 })
46 .state('app.help', {
47 url: '/help',
48 views: {
49 'menuContent': {
50 templateUrl: 'templates/help.html',
51 controller: 'HelpCtrl'
52 }
53 }
54 })
55 .state('app.notifications', {
56 url: '/notifications/:username',
57 views: {
58 'menuContent': {
59 templateUrl: 'templates/notifications.html',
60 controller: 'NotificationsCtrl'
61 }
62 }
63 })
64 .state('app.users', {
65 url: '/users',
66 views: {
67 'menuContent': {
68 templateUrl: 'templates/users.html',
69 controller: 'UsersCtrl'
70 }
71 }
72 })
73 .state('app.user', {
74 url: '/users/:username',
75 views: {
76 'menuContent': {
77 templateUrl: 'templates/user.html',
78 controller: 'UserCtrl'
79 }
80 }
81 })
82 .state('app.travels', {
83 url: '/travels',
84 views: {
85 'menuContent': {
86 templateUrl: 'templates/travels.html',
87 controller: 'TravelsCtrl'
88 }
89 }
90 })
91
92 .state('app.travel', {
93 url: '/travels/:travelId',
94 views: {
95 'menuContent': {
96 templateUrl: 'templates/travel.html',
97 controller: 'TravelCtrl'
98 }
99 }
100 });
101 // if none of the above states are matched, use this as the fallback
102 $urlRouterProvider.otherwise('/app/travels');
103})
104
105
106
107/* translator */
108.config(['$translateProvider',function($translateProvider) {
109
110 /* get lang from the file translations.js */
111 for(lang in translations){
112 $translateProvider.translations(lang, translations[lang]);
113 }
114
115 if(window.localStorage.getItem('lang')) {
116 $translateProvider.preferredLanguage(window.localStorage.getItem('lang'));
117 }else{
118 $translateProvider.preferredLanguage('english');
119 };
120
121 $translateProvider.useSanitizeValueStrategy('escape');
122
123}]);