Skip to content

Instantly share code, notes, and snippets.

@strukturedkaos
Created June 18, 2014 14:30
Show Gist options
  • Save strukturedkaos/19ddcc23496f0e893b05 to your computer and use it in GitHub Desktop.
Save strukturedkaos/19ddcc23496f0e893b05 to your computer and use it in GitHub Desktop.
Changing lists on Angular task list
// Monitor the current route for changes and adjust the filter accordingly.
$scope.$on('$routeChangeSuccess', function () {
if ($routeParams.listId) {
var listId = $routeParams.listId.split("-").pop()
var list = lists[listId];
if (list !== undefined && list !== $scope.currentList) {
$scope.currentList = list;
$scope.setTasks();
} else if (list !== $scope.currentList) {
$location.path('/');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment