Disable caching of routes in Angular 2
<p>I have a Router with some Async Routes. It works pretty well so far, but one issue I have is that it doesn't reload the javascript files.</p>

<p>Currently I'm using the loader like this (using $script.js to get and execure the JS file):</p>

<pre><code>new ng.router.AsyncRoute({
    path: '/' + pName + '/' + entryName,
    loader: () =&gt; {
        let q = new Promise(function(resolve) {
            console.log("Loading...");
            $script(['js/' + pName + '/' + entryName + '-c.js'], function() {
                resolve();
            });
        });
        return q.then(() =&gt; app[pascalCase(fullName) + "Cmp"]);
    },
    name: pascalCase(fullName),
    useAsDefault: false,
})
</code></pre>

<p>However, the <code>console.log("Loading...")</code> only gets executed the first time when I'm navigating that route, but not any subsequent times.</p>

<p>The reason why this is a problem is because A: I want the pages to be completely reset to the start (I don't just have Angular Components there, but also custom Javascript) and B: I would like to get rid of all the components and other objects in the memory because I don't want the users browser to get filled with more and more memory the longer he uses my site (as it is fairly big).</p>

<p>iirc on the Angular UI Router for Angular 1 I could just disable caching to force the reload, but how can I achieve this on Angular 2?</p>