I was writing a small app in Angular 2 in TypeScript with the on-the-fly transpiling by SystemJS.
I needed to implement a router that would switch between the Home and ProductDetail views in a single page app.
The root component had two links and was supposed to render either Home or ProductDetail components depending on which link the user clicks. Angular 2 offers a pretty elegant syntax for this: