So on a simple two components passing data, this should be easy. But on my case I am using a thirdy-party datepicker plugin, then since I have so many date fields on different forms of my app I decided to create a component of my datepicker so that I won't have to repeat the configurations in each view that I use it. The problem now is I am passing a model to the child component which is also being passed to the datepicker component like this:
parent-component.ts
...
template: `<my-custom-datepicker-component [model]="model"></my-custom-datepicker-component>
<span>{{ model }}</span>
`
...
export class ParentComponent{
model: any;
}
and in my-custom-datepicker.ts
...
template: '<datetime [(ngModel)]="model"></datetime>'
...
export class MyCustomDatepickerComponent{
@Input() model: any;
}
And here's the datepicker plugin i'm using: https://nkalinov.github.io/ng2-datetime/.
My problem is that the date selected doesn't reflect on the model of the parent component. Hope someone can help me. Thanks in advance!