Template bindings

Each component template may contain various syntactic constructs that are bound to JavaScript expressions. The simplest of such syntactic constructs is the interpolation operator: {{<expressions here>}}. The interpolation operator may be mixed in the text of text nodes, as in the following examples:

<!-- Taken from the counter component template --><p>Current count: <strong>{{ currentCount}}</strong></p><!-- works also without the strong tag --><p>Current count: {{ currentCount}}</p>

Whatever value is returned by the interpolation operator is cast to a string before being replaced in the HTML. Interpolation operators can also be placed within an HTML property value:

<p>Current count: <input type = 'text' value='{{ currentCount}}' ...

Get Hands-On TypeScript for C# and .NET Core Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.