July 2017
Intermediate to advanced
384 pages
8h 23m
English
In many cases, normal field population is just not enough; it would be more powerful to have customized content for a better experience. AutoComplete provides this feature using ng-template, which displays the custom content inside the suggestions panel. The local template variable passed to ng-template is an object from the suggestions array. The customized example of AutoComplete with the country's name and flag would be as follows:
<p-autoComplete [(ngModel)]="customCountry" name="template" [suggestions]="filteredCustomCountries" field="name" (completeMethod)="filterCustomCountries($event)" [size]="30" [minLength]="1" placeholder="Start your search"> <ng-template let-country pTemplate= ...
Read now
Unlock full access