upgrade to angular 0.9.10 and update the code with angular API changes
[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   var self = this;
12
13   $route.onChange(function() {
14     if ($location.hash === '') {
15       $location.updateHash('/view1');
16       self.$eval();
17     } else {
18       $route.current.scope.params = $route.current.params;
19       $window.scrollTo(0,0);
20     }
21   });
22
23 }, {$inject:['$route', '$location', '$window'], $eager: true});