This repository has been archived on 2020-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
sp4ke.github.com/app/js/services.js
2010-12-23 22:32:09 -08:00

22 lines
681 B
JavaScript

/* http://docs.angularjs.org/#!angular.service */
/**
* App service which is responsible for the main configuration of the app.
*/
angular.service('myAngularApp', function($route, $location, $window) {
$route.when('/view1', {template: 'partials/partial1.html', controller: MyCtrl1});
$route.when('/view2', {template: 'partials/partial2.html', controller: MyCtrl2});
$route.onChange(function() {
if ($location.hash === '') {
$location.updateHash('/view1');
this.$eval();
} else {
$route.current.scope.params = $route.current.params;
$window.scrollTo(0,0);
}
});
}, {$inject:['$route', '$location', '$window'], $creation: 'eager'});