>>>So $location.path() is returning an empty string ?
>>>Not sure if it's relevant but are you using HTML5 or Hashbang mode ?
>>>
>>
>>I didn't change anything for $locationProvider, e.g. I didn't set it (I am not sure I understood where the code is supposed to go). So, I assume we're using defaults.
>
>Default is Hashbang mode. Don't have time to check but behaviour is different to HTML5 mode. Read the relevant section in the link I posted earlier.
>Also can you try setting $location.path() directly (i.e. not adapting the current $location.path() )
>
Tried the following, no luck:
$scope.cancel = function () {
//var curPath = $location.path();
//$log.debug("Current Path: " + curPath);
//var newPath = curPath.replace("/RetailInventory/PrefsRetail", "/");
//$log.info("New Path: " + newPath);
$scope.form.$setPristine();
$scope.showForm = false; // close the form
$location.path('/');
};
I'll try playing with $locationProvider.
If it's not broken, fix it until it is.
My Blog