>>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() )
>
>>>I am trying this code
>>>
>>>
>>> $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(newPath);
>>> };
>>>
>>>But it shows both curPath and newPath as empty strings and doesn't change the path. What am I missing?
>>>
>>>>>It works, but I can see the re-loading of the page which I don't like. Is there another way to go to the root of the application but not doing a page re-load? If the last line is commented, the forms is no longer shown, but the path remains the same, which is wrong.
>>>>>
>>>>>Thanks in advance.
>>>>
>>>>Probably best to use the $location service - $location.path()
>>>>
>>>>Read this :
https://docs.angularjs.org/guide/$location