I am trying to use a two way binding in Angular 4. Here is my component code:
@Component({
selector: 'form-validation',
templateUrl: './form.validation.template.html',
encapsulation: ViewEncapsulation.None
})
export class ValidationComponent {
@Input() data;
@Output dataChange = new EventEmitter();
//...
}
But when I try to use it on something like it:
<form-validation [(data)]="data"></form-validation>
I get this error on Chrome's console:
Cannot assign to read only property 'dataChange' of object '#<ValidationComponent>'
The data
property is an array of a specific type, but even if I inform this type or inicialize the property the error happens.