How can one mark versions of an Angular 2 app?
There are some problems like views (via templateUrl
) are not getting updated in route views (child components). I've tried things like
<script>
System.config({
// baseURL: '/',
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('v1/app/boot')
.then(null, console.error.bind(console));
</script>
Or app/v1/boot
and playing with base
but it's not working.
Note: Just for the record, at development time, cached templates (introduces via templateUrl
) do annoyingly slow things. One should use incognito sessions or clear up the browser and the like. I've solved this by introducing a global var in a module like export var fileVersion = '?tmplv=' + Date.now();
and use it in components like:
@Component({
selector: 'my-component',
templateUrl: '/app/templates/my-component.html' + fileVersion,
})
So I have just to refresh the browser to see the changes. In production use either fileVersion = '';
or like export var fileVersion = '?tmplv=v3';
.