Don't crack! I'd like to talk a little bit of Angular here rather than backend and those jargons :)
As you might know,
In Angular to bind properties to your component variables use [] like below:
On the contrary in order to bind an event to an element you would use () as below:
In two-way binding you do as below in reality:
This is why
#angular #bind #event_binding #two_way_binding #banana_in_a_box
As you might know,
Angular
bind elements to component variables in order to update values. There is concept for data binding which is called Banana in a box
and its form is like [()]
(a banana in a box). This is a two-way binding mechanism. But why it is like that. Why a banana in a box? :)In Angular to bind properties to your component variables use [] like below:
<img [src]="my_source_image" />
On the contrary in order to bind an event to an element you would use () as below:
<button (click)="doSomething()">
In two-way binding you do as below in reality:
<input [ngModel]="ctrl.name" (ngModelChange)="ctrl.name=$event">
NOTE:
you bind name to ngModel
and on model change you set event value on form control name: ctrl.name=$event
.This is why
Angular uses `[()]
. It binds both properties and events in one go like a magic.#angular #bind #event_binding #two_way_binding #banana_in_a_box