@Thilo1992 wrote:
Hello all,
on the most of my ion-inputs I have similar attributes and properties and to prevent copy and pasting them again and again I want to add a directive which adds the correct attributes and properties.
Example:
I have an object containing the value and the parameters of the input.let obj = { value: 123, paras: { min: 0, max: 200, ... } }
Now I want to enterthe input like that
<ion-input myProperties [paras]="obj.paras" [(ngModel)]="obj.value"></ion-input>
to generate something like that
<ion-input myProperties [paras]="obj.paras" [(ngModel)]="obj.value" [min]="0" [max]="200"></ion-input>
But how can I achieve this?
I’ve already tried following at the directive:
this.el.nativeElement.setAttribute('min', this.min); // This only affects the ion-input but not the input itself @HostBinding('attr.min') min; // This only affects the ion-input but not the input itself @HostBinding('min') min; //Throws this error: Can't bind to 'min' since it isn't a known property of 'ion-input'.
It would be very nice if anybody could help me with this.
Thanks,
Thilo
Posts: 1
Participants: 1