Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Canceling from the form and returning to the top level
Message
From
23/09/2016 08:48:03
 
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01641209
Message ID:
01641262
Views:
17
>>>>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.

What do you mean by 'no luck' ? Does it not show the page at all or do you mean that it is still reloading the page? If it's reloading then it may be because you're in Hashbang mode. Snip:

In this mode, $location uses Hashbang URLs in all browsers. Angular also does not intercept and rewrite links in this mode. I.e. links work as expected and also perform full page reloads when other parts of the url than the hash fragment was changed.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform