I want to have a timestamp or build number somewhere on my Angular2 App so I can tell if a user is using an old cached version or not.
How to do this with AngularCLI
I solved this by appending a comment at the end of index.html with the last commit hash. For example:
ng build --prod
git rev-parse HEAD | awk '{print ""}' >> dist/index.html
You can then do a "View Source" in the browser, look at the bottom of the HTML, and see the deployed version of your app.
This of course assumes that you use git as the versioning system. You could easily change git rev-parse HEAD with any other command that outputs a unique version.