Angular 5 add event before the route change : <p>I'm want to add a alert dialog before the user click on the <code>&lt;a href="..."&gt;</code> link.</p>

<p>There are 2 types of <code>&lt;a&gt;</code> link</p>

<ol>
<li>Redirect within Angular scope <code>&lt;a routerLink="/path/to/dest"&gt;</code></li>
<li>Redirect outside of Angular app <code>&lt;a href="http://www.somewhere.com" target="_blank"&gt;</code></li>
</ol>

<p>I want to able to show an alert box when user try to go outside of Angular scope</p>

<p><a href="https://i.stack.imgur.com/6B87y.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6B87y.png" alt="Alert dialog"></a></p>

<p>I want to apply to all <code>&lt;a&gt;</code> click event <em>(kind like pre-hook)</em></p>

<p>Any way to achieve this?</p>
