Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

377
Views
disable an option of removing an item from the autocomplete multiple primeng

Any clues on how to disable an option of removing an item from the autocomplete multiple component (https://www.primefaces.org/primeng/showcase/#/autocomplete), I want to avoid removing an item (which contains a field i.e. remove:false) after the user hit the backspace button or click on x icon. For example, if you choose 'Afghanistan' you shouldn't be able to remove it.

I tried as below but without success: https://stackblitz.com/edit/primeng-autocomplete-demo-tdoe5g?file=src/app/app.component.ts

html:

<p-autoComplete (onUnselect)="avoidRemoval($event); false"
...
/>

ts:

avoidRemoval(event){
 if(!event.remove){
  event.preventDefault() //event.preventDefault is not a function
 }
}

// nothing is happening here
@HostListener("document:keyup", ["$event"])
    handleKeyup(event: KeyboardEvent) {
        if (event.keyCode === 8) {
            event.preventDefault();
            //event.stopPropagation();
            //return false;

        }
    }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!