Created
July 13, 2015 20:57
-
-
Save yajd/7b3243f1d6971202b46e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define('app',[ | |
'routes', | |
// 'cordova', | |
'angular', | |
'angularRoute', | |
'angularResource', | |
'angularTouch', | |
'config', | |
'controllers', | |
'services', | |
'directives', | |
'helpers' | |
], function(appRoute) { | |
var oApp = { | |
_app: {}, | |
init: function() { | |
console.log('init4'); | |
document.addEventListener('deviceready', this.onDeviceReady, false); | |
}, | |
onDeviceReady: function() { | |
oApp._app = angular.module('smartApp', [ | |
'ngRoute', | |
'ngTouch', | |
'ngResource', | |
'smartAppConfig', | |
'smartAppServices', | |
'smartAppControllers', | |
'smartAppDirectives', | |
'smartAppHelpers' | |
]).config(appRoute).run(function ($rootScope, $route, $location) { | |
$rootScope.passArgs = {}; | |
ang.rootScope = $rootScope; | |
ang.route = $route; | |
$rootScope.$on('$locationChangeSuccess', function (a, b, c) { | |
for (var aArg in $rootScope.passArgs) { | |
$route.current.params[aArg] = $rootScope.passArgs[aArg]; | |
delete $rootScope.passArgs[aArg]; | |
} | |
$rootScope.oldOldLocPath = $rootScope.oldLocPath; | |
console.log('$locationChangeSuccess changed!', '$route.current.params:', $route.current.params, 'event:', a, 'nowURL:', b, 'oldLocPath:', $rootScope.oldLocPath); | |
$rootScope.oldLocPath = c.substr(c.indexOf('#')+1); | |
//console.log('set rootscope old loc path:', $rootScope.oldLocPath); | |
}); | |
}); | |
angular.element(document).ready(function() { | |
angular.bootstrap(document, ['smartApp']); | |
}); | |
} | |
}; | |
return oApp; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment