0

I am trying to avoid using formbuilder, i want to use 2 way binding on the data source

below is my html, problem is in the p-dropdown, when the component loads I get all the drop down lists but the selected list is not set the data coming from options is an array of

export interface LookUpData {
    Id: number;
    Display: string;
    Description: string;
    Value: string;
}

export interface RiskQuestionaireData {
    RiskId: number;
    OrgId: number;
    QuestionDetail: QuestionDetail[];
}

export interface QuestionDetail {
    Id: number;
    Category: string;
    Question: string;
    InherentId?: number;
    CurrentId?: number;
    ResidualId?: number;
    LookUpData: LookUpData[];
    AnswerListText: string;
    InherentConsequence:LookUpData;
    CurrentConsequence:LookUpData;
    ResidualConsequence:LookUpData;
}

updated my models

I am trying to use questionDataObject.QuestionDetail[rowIndex].InherentId so I already have the saved object, that part works jsut need help showing the saved results

 <ng-template pTemplate="body" let-rowData let-rowIndex="rowIndex"  let-columns="columns"  >
            <tr>
            

              
              <td colspan="2" [pEditableColumn]="rowData">
                <p-dropdown [options]="getddlList(rowData)" optionLabel="Display"    optionValue ="Id"
                  [(ngModel)]="questionDataObject.QuestionDetail[rowIndex].InherentId" name="inherent">
                </p-dropdown>
              </td>
              
              
            </tr>
          </ng-template>
China Syndrome
  • 953
  • 12
  • 24
  • for ngModel is have tried [(ngModel)]="questionDataObject.QuestionDetail[rowIndex].InherentId" as well as [(ngModel)]="questionDataObject.QuestionDetail[rowIndex].InherentConsequence" – China Syndrome May 17 '22 at 16:51

1 Answers1

0

problem was the placeholder I used server side, it was in the json but primeng does not like it, removed it from the LookUpData and uses placeholder="sdomething here" in the p-dropdown and it works

China Syndrome
  • 953
  • 12
  • 24