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', 'starter.controllers'])
8
9.run(function($ionicPlatform) {
10 $ionicPlatform.ready(function() {
11 // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
12 // for form inputs)
13 if (window.cordova && window.cordova.plugins.Keyboard) {
14 cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
15 cordova.plugins.Keyboard.disableScroll(true);
16
17 }
18 if (window.StatusBar) {
19 // org.apache.cordova.statusbar required
20 StatusBar.styleDefault();
21 }
22 });
23})
24
25.config(function($stateProvider, $urlRouterProvider) {
26 $stateProvider
27
28 .state('app', {
29 url: '/app',
30 abstract: true,
31 templateUrl: 'templates/menu.html',
32 controller: 'AppCtrl'
33 })
34
35 .state('app.search', {
36 url: '/search',
37 views: {
38 'menuContent': {
39 templateUrl: 'templates/search.html'
40 }
41 }
42 })
43
44 .state('app.users', {
45 url: '/users',
46 views: {
47 'menuContent': {
48 templateUrl: 'templates/users.html',
49 controller: 'UsersCtrl'
50 }
51 }
52 })
53 .state('app.user', {
54 url: '/users/:username',
55 views: {
56 'menuContent': {
57 templateUrl: 'templates/user.html',
58 controller: 'UserCtrl'
59 }
60 }
61 })
62 .state('app.travels', {
63 url: '/travels',
64 views: {
65 'menuContent': {
66 templateUrl: 'templates/travels.html',
67 controller: 'TravelsCtrl'
68 }
69 }
70 })
71
72 .state('app.travel', {
73 url: '/travels/:travelId',
74 views: {
75 'menuContent': {
76 templateUrl: 'templates/travel.html',
77 controller: 'TravelCtrl'
78 }
79 }
80 });
81 // if none of the above states are matched, use this as the fallback
82 $urlRouterProvider.otherwise('/app/travels');
83});