ngSwitch with Angular 2 and TypeScript
ngSwitch directive displays one element (and its children) from a set of
possible options, based on some condition.
In the text below, when you see a word or phrase, click on it to highlight the source code.
Also, take a look at the IDE style to see this tutorial in wide-screen mode. You can always switch back using the Style link at the top of the page.
choice variable, and only the
<h3> element with the
choice is displayed. If no
ngSwitchCase is matched then
You can see this in action here.
To learn more about the other built-in directives, take a look at these tutorials.