官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 天等县| 托克逊县| 高要市| 凤冈县| 桃江县| 宁都县| 庆云县| 隆昌县| 绥滨县| 得荣县| 垣曲县| 九寨沟县| 望城县| 疏附县| 托克托县| 安宁市| 望江县| 文登市| 沙田区| 满洲里市| 余干县| 寿阳县| 广饶县| 从化市| 沐川县| 项城市| 湖口县| 卢氏县| 普定县| 五华县| 钦州市| 宜宾市| 楚雄市| 建阳市| 新郑市| 清水河县| 吉安县| 九台市| 杨浦区| 乌鲁木齐县| 惠水县|