DEV Community

tlink9252
tlink9252

Posted on

1

Angular 10 with PRIMENG DROP DOWNS Not binding saved data

Here are my models they come down from the api fine, the problem is not when I change the drop down and save that part if fine the issue is when the page loads all the drop downs are at their default

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;
}

here is the ngTemplate i use
for ngModel is have tried [(ngModel)]="questionDataObject.QuestionDetail[rowIndex].InherentId" as well as [(ngModel)]="questionDataObject.QuestionDetail[rowIndex].InherentConsequence

          <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>

angular
primeng
angular2-template
prime

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay