#Object is possible null html template

1 messages · Page 1 of 1 (latest)

turbid breach
#

I want to give EventTarget value to third pary library function (ng-select).

                <input style="width: 100%; line-height: 24px" type="text" (input)="select.filter($event.target.value)"/>
              </ng-template>```
the error is on event.target.value
scarlet star
#

Event types in angular are very narrow, if you want to pass in the value property you need to widen the type first by using $any(event.target).value, or by using a ref to get the native html element

<input #input (input)="select.filter(input.value)" />
#

Alternatively you could disable strictTemplates in tsconfig.json, but I wouldn't recommend it.