Search code examples
angularangular-ng-if

ng-hide expression not working with and and null conditions


I am trying to implement a statement that will hide the hello world. I have tried adding the expression to a function in typescript but it still would not hide it.

<div ng-hide="textformField.DefaultValueQuery == null && textformField.PlaceHolderQuery == null"> Hello World
</div>

Solution

  • ng-hide is angularjs (1.x) directive, it won;t working with Angular (2+) version. Instead use *ngIf directive. ngIf directive add/remove a DOM from DOM tree when expression evaluated to true/false.

    <div *ngIf="textformField.DefaultValueQuery == null && textformField.PlaceHolderQuery == null">
      Hello World
    </div>