0

I have a value and I need to put it in the dropdown at start:

state is an object {'code':...,'description'}

and listState in array of state 

 loadValue(stateSave: Object) {//state save is the object  just saved
   this.state={'code':stateSave['code'],'description':stateSave['description']   }

and in my html is:

    <p-dropdown [options]="listState" [(ngModel)]="state"  optionLabel="description"></p-dropdown>

My problem is that if I have an old value just saved and I want to show it but the dropdown doesn't work, because at start it doesn't show anything. Anyone can help me?

poopp
  • 1,297
  • 2
  • 13
  • 23

1 Answers1

0

In init() method, write the below code,

this.state={'code':stateSave['codice'],'description':stateSave['description']} 
surendra kumar
  • 1,686
  • 11
  • 15