Assigning Boolean Values to Angular Input Properties

Ole Ersoy
Oct 17, 2019

--

Photo by Dan Gold on Unsplash

Updated Version

There’s an updated version of this article here:

Scenario

We have a Hola component that should display HOLA! when spanish is true.

Approach

Use brackets:

<halo-comp #h [spanish]="true" [text]="h.spanish ? hola : hello"></halo-comp>

Demo

Brought to You By

--

--