Hi there, I am new to Angular 6 and currently encountering an issue with data binding. I have set up a test project with a parent-child relationship for data binding in the heading, but unfortunately, it's not working as expected. Can anyone lend me a hand with this problem?
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<h1>{{title}}</h1> //trying to display child components title variable
//within parent template
<childcomponent>Child component title is: {{title}}</childcomponent>
`
//and also inside the child componets selector
})
export class AppComponent {
title = 'Parent component';
}
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `<p>child component works</p> `
})
export class ChildComponent {
title = 'Child component';
}