@Input() is basically a decorator to bind a property as an input. It is used to pass data i.e property binding from one component to other or we can say, from parent to child component. It is bound with the DOM element. When the DOM element value is changed, Angular automatically updates this property with the changed value. Here we will see how can we use it.
Approach: @Input() can be used in two ways:
- Two-way bindings with @Input()
- One-way binding with ngOnChange() and @Input()
Output:
[video mp4="https://media.geeksforgeeks.org/wp-content/uploads/20200704204540/Output9.mp4" autoplay="on" loop="on" ][/video]