I am using primeng version 4.2.2.
I have used p-autocomplete in angular 4. I have to set the custom validation error message for the field.
The field is required field, if user is not selected and hit enter I have to customize the error message in p-autocomplete.
Please guide me how I can set the customized validation error message. In default it's showing "Please fill out this field".
Code: Select all
<p-autoComplete [(ngModel)]="name" [ngModelOptions]="{standalone: true}" [suggestions]="nameList" [required]="true" (completeMethod)="initializeNameList()" [size]="30" [minLength]="1" [dropdown]="true" [forceSelection]="true" oninvalid="setCustomValidity('Please Select a Name.')" onchange="try{setCustomValidity('')}catch(e){}" placeholder="Type or Select">
</p-autoComplete>