I am just trying to link data from a drop down menu with ngModel. I get an error while loading the application.
browser_adapter.js:84 EXCEPTION: No value accessor for ''
This makes me think that the error is due to the fact that ngModelit is not initially associated with any data when the application loads.
I'm not the best to use Observables ... so be careful.
Partial html dropdown
<p-dropdown [options]="actionsToTake" (onChange)="onToggleCreateActionInput()"
[(ngModel)]="action"></p-dropdown>
Relevant TypeScript (import excluded)
export class ActionView {
public actionsToTake: SelectItem[] = [];
public action: Action = new Action();
constructor (private actionCreateService: ActionCreateService) {
// populate dropdown list (actionsToTake) with data from service call
this.actionCreateService.getActionFields().subscribe((resp) => {
for (let i = 0; i < resp.data.data.actionElm.length; i++) {
this.actionsToTake.push({label: resp.data.data.actionElm[i].name,
value: resp.data.data.actionElm[i].name});
}
});
}
public onToggleCreateActionInput = (action): void => {
// test if something in "action" exists, and then do something based on that
};
}
, , action . , , ngModel, , , , . , , , .