Repository navigation
Expand file tree
/
Copy pathsimplebind.html
More file actions
43 lines (43 loc) · 1.93 KB
/
Copy pathsimplebind.html
File metadata and controls
43 lines (43 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-connectdevelop"></i> Simple Bind</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<div class="well well-sm">
<h5>Parent component</h5>
All <strong>"Simple"</strong> comes from this component,
2 way binding works using uni-directional data-flow, so it's not the same 2 way binding in AngularJS 1.x, fields flagged with "2-way" means it ables to update the data source then the data keeps flowing one way to all bindings.
<br>
<p>{{myname}}</p>
<button class="btn btn-default" type="button" (click)="myname='Simple'">Reset</button>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="well">
<h5>Child component:</h5>
<as-child text="Custom 1-way Binding" [fromParent]="myname"></as-child>
<as-child text="Custom 2-way Binding" [(fromParent)]="myname"></as-child>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label><h3>Using ngModel</h3></label>
<div class="form-group">
<label>1-way binding</label>
<input [ngModel]="myname" type="text" class="form-control">
</div>
<div class="form-group">
<label>2-way binding</label>
<input [(ngModel)]="myname" type="text" class="form-control">
</div>
</div>
</div>
</div>
</div>
</div>