Are you wondering how to use ngShow in Angular 11? There is a way to achieve it by using
[hidden]= “false”
. However, if you are migrating largeangularjs
projects intoangular 11
then it is really tedious and error prone work to convert them intohidden
and negate all existing logic to show the element. In this article I will explain how you can create your ownngShow
directive in Angular 11.
Here is the live site to see how ngShow
works in Angular 11.
<button [ngShow]="show">Create</button>
get show() {
return false; // it will hide button. If you pass `true` it will show button.
}