Working with Angular Components

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';

@Component({
 selector: 'app-hero-child',
 template: `
 
{{hero.name}} says:

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

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

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

Options
1.@Input('master') masterName;
2.@Input('master') masterName: string;

3.@Input(master) 'masterName';

4.@Input(master:string) 'masterName';

Related Posts

Close Bitnami banner
Bitnami