PrimeNg DropDown - User can't clear the value

UI Components for Angular
Post Reply
phpinterview1991
Posts: 1
Joined: 18 Nov 2018, 13:05

18 Nov 2018, 13:12

I'm implementing primeNg dropdown component in my Angular2 application.

Code: Select all

<p-dropdown [options]="listCustomers_itm" placeholder="Selezionare" [(ngModel)]="Customer_itm" [ngModelOptions]="{standalone: true}" [style]="{'width':'225px'}" filter="filter"  (onChange)="onCustomerSelect($event.value)">
</p-dropdown>
All works fine except one annoing thing:

Once time the user has selected an option, he can't clear the selected value...

Can you help me?

Regards
Sunil Kumar



------------------------------------------------------------
php interview questions, php interview questions and answers

yigitfindikli
Posts: 449
Joined: 08 Aug 2018, 14:09

19 Nov 2018, 14:11

Hi,
You can use showClear property like this:

Code: Select all

    <p-dropdown [options]="cities" [(ngModel)]="selectedCity" placeholder="Select a City" optionLabel="name" [showClear]="true"></p-dropdown>
If you want more info, you can look this https://www.primefaces.org/primeng/#/dropdown

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests