app.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.controllers' is found in controllers.js
  6. angular.module('starter', ['ionic', 'starter.controllers'])
  7. .run(function ($ionicPlatform) {
  8. $ionicPlatform.ready(function () {
  9. // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
  10. // for form inputs)
  11. if (window.cordova && window.cordova.plugins.Keyboard) {
  12. cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
  13. cordova.plugins.Keyboard.disableScroll(true);
  14. }
  15. if (window.StatusBar) {
  16. // org.apache.cordova.statusbar required
  17. StatusBar.styleDefault();
  18. }
  19. });
  20. })
  21. .config(function ($stateProvider, $urlRouterProvider) {
  22. $stateProvider
  23. .state('app', {
  24. url: '/app',
  25. abstract: true,
  26. templateUrl: 'templates/menu.html',
  27. controller: 'AppCtrl'
  28. })
  29. .state('app.settings', {
  30. url: '/settings',
  31. views: {
  32. 'menuContent': {
  33. templateUrl: 'templates/settings.html',
  34. controller: 'SettingsCtrl'
  35. }
  36. }
  37. })
  38. .state('app.categories', {
  39. url: '/categories',
  40. views: {
  41. 'menuContent': {
  42. templateUrl: 'templates/categories.html',
  43. controller: 'CategoriesCtrl'
  44. }
  45. }
  46. })
  47. .state('app.apps', {
  48. url: '/categories/:catId',
  49. views: {
  50. 'menuContent': {
  51. templateUrl: 'templates/apps.html',
  52. controller: 'AppsCtrl'
  53. }
  54. }
  55. })
  56. .state('app.single', {
  57. url: '/apps/:appId',
  58. views: {
  59. 'menuContent': {
  60. templateUrl: 'templates/single.html',
  61. controller: 'SingleCtrl'
  62. }
  63. }
  64. });
  65. // if none of the above states are matched, use this as the fallback
  66. $urlRouterProvider.otherwise('/app/categories');
  67. });