2016.09.29: Please note that since this article first appeared, there have been some changes to Angular 2 / Angular CLI meaning that there are some minor tweaks necessary to make the code in this article run correctly. These tweaks are detailed in the comments.
Full article