Tutorial by Examples

@input is useful to bind data between components First, import it in your component import { Input } from '@angular/core'; Then, add the input as a property of your component class @Input() car: any; Let's say that the selector of your component is 'car-component', when you call the compone...
A Button directive which accepts an @Input() to specify a click limit until the button gets disabled. The parent component can listen to an event which will be emitted when the click limit is reached via @Output: import { Component, Input, Output, EventEmitter } from '@angular/core'; @Component(...
Sometimes you need to fetch data asynchronously before passing it to a child component to use. If the child component tries to use the data before it has been received, it will throw an error. You can use ngOnChanges to detect changes in a components' @Inputs and wait until they are defined before a...

Page 1 of 1