Ng-select: Required validation without Reative Forms

Created on 16 Feb 2018  路  4Comments  路  Source: ng-select/ng-select

How do a validation without Reative forms. I did not find a demo. I tried this:

<ng-select [items]="serverSideFilterItems"
           bindLabel="label"
           bindValue="id"
           required
           (change)="onChange($event)"
           [notFoundText]="'Nenhum resultado encontrado'"
           [typeToSearchText]="'Digite para pesquisar'"
           [typeahead]="itemsTypeahead">
</ng-select>

But, dont work it. The validation state never chagnes

Most helpful comment

@varnastadeus what happens if you don't wanna add any style but instead display a message?
Can't access to the error state on ng-select.

All 4 comments

@penihel it does work, if you inspect element you would see ng-invalid. It just doesn't have any default style for that. You need to set it by yourself

It happens exactly the same. That same example does not work. the input class is ng-valid

@davidoween add plnkr to see what are you doing wrong.

@varnastadeus what happens if you don't wanna add any style but instead display a message?
Can't access to the error state on ng-select.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gitlines picture gitlines  路  4Comments

shawnshaddock picture shawnshaddock  路  3Comments

ghost picture ghost  路  4Comments

danilocgraciano picture danilocgraciano  路  4Comments

achimha picture achimha  路  4Comments