July 2017
Intermediate to advanced
384 pages
8h 23m
English
Dropdown provides a way to select an item from a collection of available options. To list out all possible options, we should use the SelectItem interface that defines label-value properties, and this list will bind to the options attribute. The two-way binding for selected items is defined through the model property. Let's display a list of countries in a dropdown for user input. A basic example of a dropdown with the list of options would be as follows:
<p-dropdown [options]="countries" [(ngModel)]="selectedCountry" [styleClass]="dropdown-width" placeholder="Select a Country"></p-dropdown>
The dropdown will be displayed with options as shown in the following screenshot:
The Dropdown ...
Read now
Unlock full access