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

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.

主站蜘蛛池模板: 左权县| 常宁市| 星子县| 丰台区| 德惠市| 泗水县| 东兰县| 平南县| 冷水江市| 桑日县| 浙江省| 旬邑县| 梅州市| 漳平市| 延庆县| 扶绥县| 通辽市| 越西县| 阿图什市| 平武县| 石城县| 兴义市| 甘德县| 威信县| 织金县| 精河县| 昌黎县| 沈阳市| 灵丘县| 资兴市| 淮滨县| 镇江市| 巴林右旗| 鄱阳县| 大化| 邹平县| 望奎县| 新营市| 武义县| 文昌市| 射阳县|