angularjs - how to show validate message in form in angular 2? -


i trying show validate message in form in angular 2 ? getting error

cannot read property 'haserror' of undefined

i added these lines

 <div *ngif="username.haserror('required') && username.touched"             class="error-box"> username required</div>            <div *ngif="username.haserror('minlength') && username.touched"             class="error-box"> minimum password length 8!</div> 

here code https://plnkr.co/edit/slhyswt0mjxklogk1kfo?p=preview

this should want:

<ion-input type="text" ngcontrol="username" #username="ngform"></ion-input> 
 <div *ngif="username.errors?.required && username.touched"             class="error-box"> username required</div>            <div *ngif="username.errors?.minlength && username.touched"             class="error-box"> minimum password length 8!</div> 

plunker example


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -