Handling internal server error ( 500 ) in angular js and redirecting to login page on such event.