File not found 404 Error should be thrown using AngularJS when the user enter the invalid webpage url after login into the webpage -
i trying throw 404 error when user enter invalid url after permitting user webpage. example home login page , allowing user login page as( home/ )and can throw 404 error. after login page user enter url called (/employee) , struggling in throwing 404 error when user enter (/employee/invalid url). can guide me how , code here:
app.run(function ($rootscope, $window, $location, sessionservice, $cookies, $cookiestore) {
$rootscope.$on("$routechangestart", function (event, nextroute, currentroute) { var currentpath = $location.path(); currentpath = currentpath.split('/'); if (currentpath[1] === "") { $location.path("/home"); } else if (currentpath[1] === "employee") { if ((nextroute.access && nextroute.access.requiredlogin) && !$window.sessionstorage.boid) { $location.path("/employee"); } } else if (currentpath[1] === "department") { if ((nextroute.access && nextroute.access.requiredlogin) && !$window.sessionstorage.retailerid) { $location.path("/department"); } } else { $location.path("/404.html"); } });
}); above code throw 404 (/employee) , not (/employee/invalid url)
Comments
Post a Comment