title: Angular - 404 HTTP Interceptor
body: <p>Whenever my node server returns a 404 error, I want this to be intercepted by my Angular app and the user directed to a certain route.</p>
  
  <p>I'm trying to build a simple interceptor to do this however it doesn't seem to return anything.</p>
  
  <p>Any pointers on why this code won't print anything when the 404 is coming in (I've confirmed this by looking at the page header):</p>
  
  <p><a href="https://i.stack.imgur.com/apPJQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/apPJQ.png" alt="enter image description here"></a></p>
  
  <p>And the code:</p>
  
  <pre><code>.config(function($httpProvider) {
    //Ignore this authInceptor is for saving my JWT's
    $httpProvider.interceptors.push('authInterceptor');
  
    //This is the one I'm having issue with
    $httpProvider.interceptors.push(function myErrorInterceptor($window, $location) {
      return {
        requestError: function(res){
          if (res.status === 404) {
            console.log('You're In - Now do some more stuff')
          }
          return res;
        }
      }
    })
  })
  </code></pre>
  
  <p>UPDATE:
  So in addition to that, i've realised on my node side - i have</p>
  
  <pre><code>//This section is to handle Angular HTML5Mode Urls
  //Have to rewrite all your links to entry point of your application (e.g. index.html)
  app.get('/*', function(req, res) {
    res.sendFile(__dirname + '/site/index.html')
  });
  </code></pre>
  
  <p>So another issue here is - that <code>app.get('/*'</code> won't be bale to distinguish between whats allowed as per Angular routes - so how do i get it be aware of that? (Don't want something an array where i duplicate code)</p>