So i am using a date picker component from ng2-bootstrap, I’m slowly rewriting it to understand everything thats going on…
public constructor(@Self() cd:NgModel) {
this.cd = cd;
cd.valueAccessor = this;
return this
}
So whats happening here? I don’t understand
Have you considered the ionic 2 date time picker?
I have, but i still like to learn.
i understand that cd is of type NgModel but i don’t understand what the @Self() decorator really means.
this.cd = cd
Assigns the NgModel to the variable cd.
cd.valueAccessor = this
assigns the valueAccessor the entire class??
so the class is assigned itself as a variable?
I’m returning the class in the constructor? what?