How can I set dynamically the input attribute of my subcomponent with one way binding in angular 4?
For example I have following subcomponent:
@Component({
selector: 'app-page-header',
templateUrl: './page-header.component.html',
styleUrls: ['./page-header.component.scss']
})
export class PageHeaderComponent {
@Input() heading: string;
}
If I am using this subcomponent in my component as follows it works:
<app-page-header [heading]="'Hello world'"></app-page-header>
But I want dynamically set the heading attribute of my subcomponent like this
<app-page-header [heading]="{{myfield}}"></app-page-header>
or even with pipes
<app-page-header [heading]="{{ 'MY_TEXT_FIELD' | translate:lang }}"></app-page-header>
But it does not work.
How can I achieve this and how is the syntax? Thank you in advance for your answers.