Directives
#
How remove/add DOM through binder scope?if
directive will remove/add HTMLElement that can be accessed via binder scopes.
Example:
Setup 'if' attribute with new binder scope property.
./src/app/app-component.html
Just set true
/false
to binder scope property.
./src/app/app-component.js
#
How to display list of data to DOM?loop
directive will render Array of objects to the DOM automatically once you assign, add, remove or modify array on binder scope with array property.
Example:
Setup loop
attribute with new binder scope property and set el
attributes with scopes to its child HTMLElement whichever you need in *-component.html
- Render whole array of objects by just assign the array to binder scope property
- Add, remove or modify array of object will reflect automatically towards binded DOM. We can use any array methods which modified object.
- Basically these methods
pop, push, reverse, shift, unshift, splice, sort
will work out.
Note: Before using array methods on binder scope assign with empty/array of object to initiate functionality.
./src/app/app-component.js