Working with objects

Until now, AutoComplete has shown its power on primitive types, but it can work with object types as well. The value passed to the model would be an object instance, but the field property defines the label to be displayed as a suggestion. That is, in this case, the field property is used to display any property of the object as a label. The following example shows the power of the object usage:

<p-autoComplete id="instance" [(ngModel)]="countryInstance" name="instance"
[suggestions]="filteredCountryInstances"
(completeMethod)="filterCountryInstances($event)" field="name">
</
p-autoComplete>

In the preceding example, the Country object is used as a model object instance and the suggestions displayed are from the country using the name field property.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.178.181