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>