"use strict";

angular.module("hikeio").
	factory("navigation", ["$location", function($location) {
		var NavigationService = function() {
		};

		NavigationService.prototype.toSearch = function(query) {
			$location.url("/search?q=" + query);
		};

		NavigationService.prototype.toIndex = function() {
			return $location.path("/");
		};

		NavigationService.prototype.onIndex = function() {
			return $location.path() === "/";
		};

		NavigationService.prototype.toEntry = function(id) {
			$location.path("/hikes/" + id);
		};

		NavigationService.prototype.onEntry = function() {
			var regex = /\/hikes\/(?!.*\/edit$)/;
			return regex.test($location.path());
		};

		NavigationService.prototype.onEntryEdit = function() {
			var regex = /\/hikes\/.*?\/edit/;
			return regex.test($location.path());
		};

		return new NavigationService();
	}]);
"use strict";

angular.module("hikeio").
	factory("navigation", ["$location", function($location) {
		var NavigationService = function() {
		};

		NavigationService.prototype.toSearch = function(query) {
			$location.url("/search?q=" + query);
		};

		NavigationService.prototype.toIndex = function() {
			return $location.url("/");
		};

		NavigationService.prototype.onIndex = function() {
			return $location.path() === "/";
		};

		NavigationService.prototype.toEntry = function(id) {
			$location.url("/hikes/" + id);
		};

		NavigationService.prototype.onEntry = function() {
			var regex = /\/hikes\/(?!.*\/edit$)/;
			return regex.test($location.path());
		};

		NavigationService.prototype.onEntryEdit = function() {
			var regex = /\/hikes\/.*?\/edit/;
			return regex.test($location.path());
		};

		return new NavigationService();
	}]);
Use $location.url() instead of $location.path() to remove url params.
Use $location.url() instead of $location.path() to remove url params.
