Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.