Tuesday, 25 April 2017

How can i redirect to another page without loading the current page in angularjs

I want to redirect to another page without loading the currentpage.

let me explain my task. I am having user login condition.

If the user has not login and he tries to enter the URL directly EX("localhost/sample.html") means it will come to login page. For me this condition is working nicely.

First sample.html page open and then only it will redirect to login. The user able to see the Data in sample.html.

var logincheck = function () {
    debugger;
    $http.get('loggedin').success(function (user) {
        alert(user);
        // Authenticated
        if (user != '0') {
            refresh();
            return;

        }
            // Not Authenticated
        else {
            $window.location.href = '/';
        }
    });
};
logincheck();

Is there any way to go login page without loading the sample.html page.



via Vinoth

No comments:

Post a Comment