Property Binding -
If you need to pass the value from the parent component to the child component (regardless of whether the value is static or dynamic), we must use property binding
, which means that we send the value using the attribute to the component and get there in the parent using the annotation @Input
, e.g. property bindings, see here -
<my-child [myProp]="prop" />
Event Binding -
Capturing child event / method from parent component
whenever we need to fire any event on a click or something else from a child component and go to the parent, we must use Event Binding
, see here in the example below -
<my-child [myProp]="prop" (onPropChange)="onPropChange($event)"</strong> />
here we have the onPropChange
user as an event binding, we can catch and fire this event using EventEmitter.
See here for more details.
source share