Skip to main content
added 249 characters in body
Source Link
Christian Santos
  • 5.5k
  • 1
  • 20
  • 24

You are looking for ngIf:

<i ng-if="$ctrl.voltage"></i>

The icon above will only render in the DOM if the ngIf expression evaluates to a "truthy" value.

If you still want the <i> to exist in the DOM but be hidden with CSS, you can use ngHide and ngShow like so:

<i ng-hide="!$ctrl.voltage"></i>
<i ng-show="$ctrl.voltage"></i>

For further reading:

You are looking for ngIf:

<i ng-if="$ctrl.voltage"></i>

The icon above will only render in the DOM if the ngIf expression evaluates to a "truthy" value.

If you still want the <i> to exist in the DOM but be hidden with CSS, you can use ngHide and ngShow like so:

<i ng-hide="!$ctrl.voltage"></i>
<i ng-show="$ctrl.voltage"></i>

You are looking for ngIf:

<i ng-if="$ctrl.voltage"></i>

The icon above will only render in the DOM if the ngIf expression evaluates to a "truthy" value.

If you still want the <i> to exist in the DOM but be hidden with CSS, you can use ngHide and ngShow like so:

<i ng-hide="!$ctrl.voltage"></i>
<i ng-show="$ctrl.voltage"></i>

For further reading:

Source Link
Christian Santos
  • 5.5k
  • 1
  • 20
  • 24

You are looking for ngIf:

<i ng-if="$ctrl.voltage"></i>

The icon above will only render in the DOM if the ngIf expression evaluates to a "truthy" value.

If you still want the <i> to exist in the DOM but be hidden with CSS, you can use ngHide and ngShow like so:

<i ng-hide="!$ctrl.voltage"></i>
<i ng-show="$ctrl.voltage"></i>