the initial version
[angular-drzb] / app / js / services.js
1 /* http://docs.angularjs.org/#!angular.service */
2
3 /**
4  * App service which is responsible for the main configuration of the app.
5  */
6 angular.service('myAngularApp', function($route, $location, $window) {
7
8   $route.when('/view1', {template: 'partials/partial1.html', controller: MyCtrl1});
9   $route.when('/view2', {template: 'partials/partial2.html', controller: MyCtrl2});
10
11   $route.onChange(function() {
12     if ($location.hash === '') {
13       $location.updateHash('/view1');
14       this.$eval();
15     } else {
16       $route.current.scope.params = $route.current.params;
17       $window.scrollTo(0,0);
18     }
19   });
20
21 }, {$inject:['$route', '$location', '$window'], $creation: 'eager'});