Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
replace $route with custom routing since it's more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed May 9, 2011
1 parent f1202fb commit 83ea3fe
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions js/app.js
@@ -1,23 +1,22 @@
/**
* Application controller for the entire page
*/
function AppCtrl($route, $location) {
function AppCtrl($location) {
var scope = this;

scope.angular = {version: '0.9.15', name: 'lethal-stutter'}

$route.when('/')
$route.when('/:subpage');
$route.onChange(function() {
if ($route.current) {
scope.subpage = $route.current.params.subpage;
//normalize hash, set subpage and track page view
scope.$watch(function() { return $location.hash }, function() {
var hash = $location.hash;

//normalize an track page view
_gaq.push(['_trackPageview', '/' + (scope.subpage || '')]);
if (hash == '/' || hash == '/downloads' || hash == '/community') {
scope.subpage = hash.substring(1);
_gaq.push(['_trackPageview', hash]);
} else {
$location.hash = '/';
}
});

$location.hash = $location.hash || '/';
}


Expand Down

0 comments on commit 83ea3fe

Please sign in to comment.