response.sendRedirect not working between Java and AngularJS
<p>I am trying to set up a login page for my website, however at the moment I am stuck on the <code>sendRedirect</code> method, as it doesn't appear to load a new page when required.</p>

<p>My login page is a .jsp file that passes the username and password information via AngularJS <code>$scope</code> to the servlet, which contains the following code:</p>

<pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
    System.out.println("Redirecting...");
    response.sendRedirect("https://www.youtube.com/");
    return;
}
</code></pre>

<p>The <code>System.out.println("Redirecting...");</code> works, however it does not redirect to the URL provided, no matter what that is. I have read other advice which mentioned to add the <code>return;</code> line, and I have tried other URLs specific to my project (e.g. <code>index.jsp</code>, <code>\index.jsp</code>, etc.), however none of these have made a difference and it still does not work.</p>

<p>Would <code>window.location</code> be a more suitable approach for this? What code should I be modifying here?</p>