Skip to content

Instantly share code, notes, and snippets.

@vahidvdn
Last active December 12, 2021 12:19
Show Gist options
  • Save vahidvdn/d776bbb029085b0c0eb0668226607bac to your computer and use it in GitHub Desktop.
Save vahidvdn/d776bbb029085b0c0eb0668226607bac to your computer and use it in GitHub Desktop.
Angular relation between component - Car
@Component({
selector: 'car',
template: '<wheel color="color"></wheel>',
})
export class CarComponent implements OnInit {
color: string = 'red';
}
@Component({
selector: 'wheel',
template: '<screw color="color"></screw>',
})
export class WheelComponent implements OnInit {
@Input('color') color: string;
}
@Component({
selector: 'screw',
template: 'This is the color: {{color}}',
})
export class WheelComponent implements OnInit {
@Input('color') color: string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment