0

I am having a very hard time trying to preselect my p-multiselect. This is my code what is wrong about it?

    <form>
      <div class="field">
        <b> <label>Algum Tipo em Particular?</label></b>
     <p-multiSelect   
      [options]="tiposImovel" [(ngModel)]="tiposSelecionados" optionValue="valor" optionLabel="tipo"></p-multiSelect>
  </div>
</form>

To narrow the case I am executing this on the ngInit

       this.tiposImovel = [
      {tipo: 'Casa', valor: 'casa'},
      {tipo: 'Apartamento', valor: 'apartamento'},
    
  ];

    this.tiposSelecionados = [
      {tipo: 'Casa', valor: 'casa'},
      {tipo: 'Apartamento', valor: 'apartamento'},
    
  ];

My intention is to select all "options". But none is selected. As you can see my ngModel is set correctly. My code is not setting those variables anywhere else. I wonder if the developers even test what they do.

Diego Alves
  • 2,462
  • 3
  • 32
  • 65

0 Answers0