1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Unable to set value for p-dropdown in angular

Discussão em 'Angular' iniciado por Swapn, Outubro 14, 2024.

  1. Swapn

    Swapn Guest

    > html file

    <p-dropdown name="abc"
    formControlName="abc" #abcDropdown
    (onChange)="abcOptionSelected('abc')"
    [options]='abcDropdownOptions' styleClass='ee-input' placeholder=''
    [style]="{'width': '50%'}">
    </p-dropdown>

    > component.ts file
    abcOptions.forEach(abcd=> {
    this.abcDropdownOptions.push({ label: abcd.toString(), value: abcd});
    });
    this.formControls.abc.setValue(3);


    what am i doing wrong. I am trying to setvalue for p-dropdown from component.ts but the value is not reflecting in UI.

    Continue reading...

Compartilhe esta Página