Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting window.location.href takes a long time
Message
 
 
To
All
General information
Forum:
Javascript
Category:
Other
Title:
Setting window.location.href takes a long time
Miscellaneous
Thread ID:
01626184
Message ID:
01626184
Views:
54
Hi everybody,

I have a single page form. In the Cancel method of this form I tried the following code (I've added last line of code just now):
$scope.cancel = function () {
                $scope.form.$setPristine();
                $scope.showForm = false;
                window.location.href = "/";
            };
It works but with a considerable delay. E.g. the form disappears, but the URL changes only after about 20+ seconds to the localhost. Is there a better way to apply similar functionality? E.g. I simply want to re-set the current view to point to nothing as we "closed" that form by pressing 'Cancel'.

The top of my controller has the following:
(function () {
    'use strict';

    var app = angular.module('sysMgrApp');

    app.config(['$stateProvider', function ($stateProvider) {
        $stateProvider.state('home', {
            url: '/',
            controller: 'prefsAcsCrudController',
            template: ''
        }).state('accountUDFs', {
            url: '/AccountUDFs',
            templateUrl: 'customerAccounts/PrefsAcs/AccountsUDFs'
        }).state('invoiceUDFs', {
            url: '/InvoiceUDFs',
            templateUrl: 'customerAccounts/PrefsAcs/InvoiceUDFs'
        }).state('confirmationText', {
            url: '/ConfirmationText',
            templateUrl: 'customerAccounts/PrefsAcs/ConfirmationText'
        });
    }]);
The problem I am trying to solve I described in another thread and this StackOverflow thread:

http://stackoverflow.com/questions/33109910/how-to-reload-page-angularjs

E.g. I go to one page form from the Favorites menu, I then press 'Cancel', then I try to open that same form again (it's supposed to go to that same URL) and then nothing happens besides spinning wheel image. My idea is to go to some place else (best to the /) so the Favorites menu will work (and it does work with that).

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform