<p dir="auto">The old router had this method <a href="https://github.com/angular/angular/blob/2.0.0-rc.4/modules/%40angular/router-deprecated/src/router.ts#L139"><code class="notranslate">router.isRouteActive()</code></a> which could be used to check whether a route was active.</p>
<p dir="auto">The new v3 component router does not offer this. Instead, the <code class="notranslate">RouterLinkActive</code> directive uses <a href="https://github.com/angular/angular/blob/2.0.0-rc.4/modules/%40angular/router/src/directives/router_link_active.ts#L99">some custom logic</a> to figure out whether a route is active or not. It all boils down to comparing the current <code class="notranslate">UrlTree</code> with the target <code class="notranslate">UrlTree</code> using <a href="https://github.com/angular/angular/blob/2.0.0-rc.4/modules/%40angular/router/src/url_tree.ts#L16"><code class="notranslate">containsTree</code></a>.</p>
<p dir="auto">Unfortunately, <code class="notranslate">containsTree</code> is not exported at module level. So anyone who wants to figure out whether a route is active or not (and cannot use the directive) has to implement all this logic on their own.</p>
<p dir="auto">Can we <a href="https://github.com/angular/angular/blob/2.0.0-rc.4/modules/%40angular/router/index.ts">reexport</a> the <code class="notranslate">containsTree</code> function, so it can be used?</p>
<p dir="auto">Usually, users create test components to test a component of a library that they wrote.<br>
However, if the component under test is an internal one and shouldn't be used by other users, the corresponding NgModule won't export that directive.<br>
The only way for a test component to use such a component under test is to duplicate the NgModule definition to be able to add the test component to the <code class="notranslate">declarations</code>. This leads to hard to maintain code.</p>