Set ngModel and ngModelChange programmatically

238 Views Asked by At

I can do the following in HTML:

<input
    type="text"
    [(ngModel)]="..."
    (ngModelChange)="..."  />

Now I have to set ngModel and ngModelChange programmatically in a Typescript-Function. This is my function:

public AttachUserSelector(inputElement: HTMLInputElement, options: UserSelectorOptions) {
    // TODO: set ngModel and ngModelChange for inputElement
    //       ngModel should bind to the property options.model
    //       ngModelChange should bind to the function options.modelChange(event: any)
}

Can someone help me, how I can do this?

0

There are 0 best solutions below