ngEl
We use ngEl
to modify element properties
:exclamation: NOTE: Using
ngEl
is rather discouraging as it cannot be cached and every model sync will cause the DOM modification even if the expression ofngEl
wasn't changed
Syntax
<el data-ng-el="expression => eval:void" />
Examples
(new NgTemplate( document.body , `<i data-ng-el="this.className = class"></i>` ))
.sync({ class: "is-hidden" });
console.log( document.body.innerHTML ); // <i class="is-hidden"></i>
<i data-ng-el="this.textNode = mymodel.foo"></i>
<i data-ng-el="this.setAttribute( 'name', mymodel.foo )"></i>
<i data-ng-el="this.disabled = state.isVisible"></i>
<i data-ng-el="this.classList.toggle('name', model.foo)"></i>