Component Interaction in Angular

You are using the following angular code to pass data from parent to child with input binding.

import { Component, Input } from '@angular/core';

import { Hero } from './hero';

 selector: 'app-hero-child',
 template: `
{{}} says:

I, {{}}, am at your service, {{masterName}}.

export class HeroChildComponent {
 @Input() hero: Hero;

What can be used in place of XXX to alias the child component property name masterName as ‘master’?

1.@Input('master') masterName;
2.@Input('master') masterName: string;
3.@Input(master) 'masterName';
4,@Input(master:string) 'masterName';

Related Posts