Data Binding


Data binding binds data from a custom element (host element) to the property or attribute of an element in its local DOM (child or target element).Data Binding is a mechanism of coordinating what users see on the screen(view).Based on data flow direction we can classify data binding into 2 types.

Data Direction Syntax
One way [[< property_name>]]
Two way {{< property_name>}}


\\Syntax
< input value="{{user-Name::input-data}}">
----------------------------------------------------------------
\\Example :-
\\ If anyone wants to use the property for two way binding then we have to use property notify and set the notify property key to true.
static get properties(){
return {
userName:{
type:String,
notify:true
} } }
-----------------------------------------------------------------
\\then we can use it in the view
< input type="text" placeholder="Enter Username" value="{{userName::blur}}" required>




Visit :


Discussion


* You must be logged in to add comment.