app.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Ionic Starter App
  2. // angular.module is a global place for creating, registering and retrieving Angular modules
  3. // 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
  4. // the 2nd parameter is an array of 'requires'
  5. // 'starter.services' is found in services.js
  6. // 'starter.controllers' is found in controllers.js
  7. angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])
  8. .run(function($ionicPlatform) {
  9. $ionicPlatform.ready(function() {
  10. // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
  11. // for form inputs)
  12. if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
  13. cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
  14. cordova.plugins.Keyboard.disableScroll(true);
  15. }
  16. if (window.StatusBar) {
  17. // org.apache.cordova.statusbar required
  18. StatusBar.styleDefault();
  19. }
  20. });
  21. })
  22. .config(function($stateProvider, $urlRouterProvider) {
  23. // Ionic uses AngularUI Router which uses the concept of states
  24. // Learn more here: https://github.com/angular-ui/ui-router
  25. // Set up the various states which the app can be in.
  26. // Each state's controller can be found in controllers.js
  27. $stateProvider
  28. // setup an abstract state for the tabs directive
  29. .state('tab', {
  30. url: '/tab',
  31. abstract: true,
  32. templateUrl: 'templates/tabs.html'
  33. })
  34. // Each tab has its own nav history stack:
  35. .state('tab.dash', {
  36. url: '/dash',
  37. views: {
  38. 'tab-dash': {
  39. templateUrl: 'templates/tab-dash.html',
  40. controller: 'DashCtrl'
  41. }
  42. }
  43. })
  44. .state('tab.chats', {
  45. url: '/chats',
  46. views: {
  47. 'tab-chats': {
  48. templateUrl: 'templates/tab-chats.html',
  49. controller: 'ChatsCtrl'
  50. }
  51. }
  52. })
  53. .state('tab.chat-detail', {
  54. url: '/chats/:chatId',
  55. views: {
  56. 'tab-chats': {
  57. templateUrl: 'templates/chat-detail.html',
  58. controller: 'ChatDetailCtrl'
  59. }
  60. }
  61. })
  62. .state('tab.account', {
  63. url: '/account',
  64. views: {
  65. 'tab-account': {
  66. templateUrl: 'templates/tab-account.html',
  67. controller: 'AccountCtrl'
  68. }
  69. }
  70. });
  71. // if none of the above states are matched, use this as the fallback
  72. $urlRouterProvider.otherwise('/tab/dash');
  73. });