ngIf

We use NgFor to toggle visibility of an element (subtree) within the DOM

Syntax

<el data-ng-if="expression => condition:boolean" />

Examples

let template = new NgTemplate( document.body , `<i data-ng-if="toggle">Hello!</i>` );

template.sync({ toggle: false });
console.log( document.body.innerHTML ); // <ng style="display: none; "></ng>

template.sync({ toggle: true });
console.log( document.body.innerHTML ); // <i>Hello!</i>

results matching ""

    No results matching ""