Mudanças entre as edições de "Data binding"

De Basef
Ir para: navegação, pesquisa
 
(3 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
* Variable binding
+
* Variable binding:
 
<source lang="javascript">
 
<source lang="javascript">
 
{{ value }}
 
{{ value }}
Linha 5: Linha 5:
  
  
* Property binding
+
* Property binding:
 
<source lang="javascript">
 
<source lang="javascript">
 
[property]="value"
 
[property]="value"
 
</source>
 
</source>
  
 +
or
  
* Event binding
 
 
<source lang="javascript">
 
<source lang="javascript">
[event]="handler"
+
bind-property="value"
 
</source>
 
</source>
  
  
* Bi-directional property binding
+
* Event binding:
 +
<source lang="javascript">
 +
(event)="handler"
 +
</source>
 +
 
 +
or
 +
 
 +
<source lang="javascript">
 +
on-event="handler"
 +
</source>
 +
 
 +
 
 +
* Bi-directional property binding (any change in DOM is reflected in the component and vice versa):
 
<source lang="javascript">
 
<source lang="javascript">
 
[(ngModel)]="property"
 
[(ngModel)]="property"
 
</source>
 
</source>
  
[[Category: AngularJS2]]
+
or
 +
 
 +
<source lang="javascript">
 +
bindon-ngModel="property"
 +
</source>
 +
 
 +
[[Category: Angular]]

Edição atual tal como às 09h38min de 27 de janeiro de 2020

  • Variable binding:
{{ value }}


  • Property binding:
[property]="value"

or

bind-property="value"


  • Event binding:
(event)="handler"

or

on-event="handler"


  • Bi-directional property binding (any change in DOM is reflected in the component and vice versa):
[(ngModel)]="property"

or

bindon-ngModel="property"