I have a child component which gets an attribute value from the parent component using @Input directive. the problem is that two way data binding does not seem to work with this input attribute. any idea what could be a reason for that?
child component class
@Component({
selector: 'app-edit-property',
templateUrl: './edit-property.component.html',
styleUrls: ['./edit-property.component.css']
})
export class EditPropertyComponent implements OnInit {
@Input() property: any;
constructor(
private propertiesService: PropertiesService
) { }
ngOnInit() {
}
}
template
<input type="text" class="form-control" required name="title" [(ngModel)]="property.title" #title="ngModel">
parent component
<app-edit-property [property]='property'></app-edit-property>