Created
June 19, 2013 20:13
-
-
Save kapv89/5817633 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
angular.module('sorter').controller('AppCtrl', function ($scope, $uri, $route, $location, $window) { | |
var navItem = function (slug) { | |
var item = { | |
title : slug[0].toUpperCase() + slug.slice(1), | |
slug : slug, | |
uri : $uri.page(slug) | |
}; | |
item.isActive = function () { | |
return this.uri === $location.path(); | |
}; | |
return item; | |
} | |
$scope.navItems = [navItem('artists'), navItem('events'), navItem('videos'), navItem('songs')]; | |
var loadComponents = function () { | |
$scope.filterTmpl = $route.current.filterTmpl | |
$scope.listingTmpl = $route.current.listingTmpl | |
$scope.weightManagerTmpl = $route.current.weightManagerTmpl | |
}; | |
$scope.$on('auth-failed', function ($ev) { | |
$window.location.reload(); | |
}); | |
$scope.$on('$routeChangeSuccess', function ($ev, $cur, $prev) { | |
loadComponents(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment