Angular2 - How to do an interceptor in order to detect a 500 and 404 error in my app.ts file?
<p><strong>Angular2 - How to do an interceptor in order to detect a 500 and 404 error in my app.ts file?</strong></p>

<p>I want to detect a 500 or 404 error in my app.ts file so I can do a redirect to my html 404 and html 500 pages accordingly.</p>

<p>Is this possible.
I could do it in angular 1.x</p>

<p><strong>Would this work?</strong></p>

<pre><code>    this.router.subscribe((currentRoute, error) =&gt; {
        if(error){
             //do redirect here???
        }

    })
</code></pre>

<p>Thank you.</p>