Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. define('app',[
  2. 'routes',
  3. // 'cordova',
  4. 'angular',
  5. 'angularRoute',
  6. 'angularResource',
  7. 'angularTouch',
  8. 'config',
  9. 'controllers',
  10. 'services',
  11. 'directives',
  12. 'helpers'
  13. ], function(appRoute) {
  14. var oApp = {
  15. _app: {},
  16.  
  17. init: function() {
  18. console.log('init4');
  19. document.addEventListener('deviceready', this.onDeviceReady, false);
  20. },
  21.  
  22. onDeviceReady: function() {
  23. oApp._app = angular.module('smartApp', [
  24. 'ngRoute',
  25. 'ngTouch',
  26. 'ngResource',
  27.  
  28. 'smartAppConfig',
  29. 'smartAppServices',
  30. 'smartAppControllers',
  31. 'smartAppDirectives',
  32. 'smartAppHelpers'
  33. ]).config(appRoute).run(function ($rootScope, $route, $location) {
  34. $rootScope.passArgs = {};
  35. ang.rootScope = $rootScope;
  36. ang.route = $route;
  37.  
  38. $rootScope.$on('$locationChangeSuccess', function (a, b, c) {
  39. for (var aArg in $rootScope.passArgs) {
  40. $route.current.params[aArg] = $rootScope.passArgs[aArg];
  41. delete $rootScope.passArgs[aArg];
  42. }
  43. $rootScope.oldOldLocPath = $rootScope.oldLocPath;
  44. console.log('$locationChangeSuccess changed!', '$route.current.params:', $route.current.params, 'event:', a, 'nowURL:', b, 'oldLocPath:', $rootScope.oldLocPath);
  45. $rootScope.oldLocPath = c.substr(c.indexOf('#')+1);
  46. //console.log('set rootscope old loc path:', $rootScope.oldLocPath);
  47. });
  48. });
  49.  
  50. angular.element(document).ready(function() {
  51. angular.bootstrap(document, ['smartApp']);
  52. });
  53. }
  54. };
  55.  
  56. return oApp;
  57. }
  58. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement