Skip to content

Instantly share code, notes, and snippets.

@jessemcdowell
Created April 1, 2014 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessemcdowell/9920643 to your computer and use it in GitHub Desktop.
Save jessemcdowell/9920643 to your computer and use it in GitHub Desktop.
Angular Navigation
'use strict';
// var module = angular.module('...', []);
module.service('navigation', function($location) {
var storage = null;
return {
navigate: function(path, data) {
storage = {
path: path,
data: data
};
$location.path(path);
},
getNavigationData: function() {
if ((storage == null) || (storage.path != $location.path())) {
throw 'navigated without passing data';
}
var data = storage.data;
storage = null;
return data;
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment