Search code examples
angularjssubstringng-show

ngShow if interpolated substring equals some substring


I have the following title, and I want to show an element if person == some value, e.g family. How can I build that expression with ngShow?

<h2 class="mat-title" style="text-align:center;">Register as a {{person}}</h2>


Solution

  • You can use ng-if

    <h2 ng-if="person==='family'" class="mat-title" style="text-align:center;">Register as a {{person}}</h2>