Skip to content

Instantly share code, notes, and snippets.

@umairhm
Last active July 25, 2020 04:43
Show Gist options
  • Save umairhm/1a3f438943a3b933cd3739308bb4536d to your computer and use it in GitHub Desktop.
Save umairhm/1a3f438943a3b933cd3739308bb4536d to your computer and use it in GitHub Desktop.
<!-- Input names only, Angular will set the value as empty string ('') -->
<!-- Supposed to be truthy -->
<boolean-coercion flagOne flagTwo></boolean-coercion>
<!-- Strings true/false, without expressions -->
<boolean-coercion flagOne="false" flagTwo="true"></boolean-coercion>
<!-- Random string values, without expressions -->
<boolean-coercion flagOne="random" flagTwo="random"></boolean-coercion>
<!-- Number, with or without expressions -->
<boolean-coercion [flagOne]="0" flagTwo="1"></boolean-coercion>
<!-- Number, with or without expressions -->
<boolean-coercion [flagOne]="0" flagTwo="1"></boolean-coercion>
<!-- Some object, null or undefined value -->
<boolean-coercion [flagOne]="person1" [flagTwo]="nullValue"></boolean-coercion>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment