2 Answer(s)
-
0
The error
NG01203: No value accessor for form control name: 'authorId'
in your ABP Suite-generated Angular UI typically means the form control is not bound to a compatible Angular Material component (like<mat-select>
) or the necessary module is not imported.In a one-to-many navigation (e.g., Book → Author), ABP Suite should generate a dropdown for selecting the related entity (Author) in both the create/edit form and the advanced filter. If this is missing, it is usually due to:
- The
<mat-select>
component is not used for theauthorId
field. - The
MatSelectModule
is not imported in your feature or shared module. - The lookup data for authors is not loaded or bound to the dropdown.
- The
How to Fix:
- Ensure
<mat-select>
is used forauthorId
:
<mat-form-field> <mat-label>Author</mat-label> <mat-select formControlName="authorId" required> <mat-option *ngFor="let author of authors" [value]="author.id"> {{ author.name }} </mat-option> </mat-select> </mat-form-field>
- Import
MatSelectModule
in your module:
import { MatSelectModule } from '@angular/material/select'; @NgModule({ imports: [ // ... other imports MatSelectModule ] }) export class SharedModule { }
- Load and bind the authors list: In your component:
authors: AuthorDto[] = []; ngOnInit() { this.authorService.getList().subscribe(result => { this.authors = result.items; }); }
Advanced Filter Dropdown: Similarly, use
<mat-select>
for the filter and bind the authors list.Regenerate Code if Needed: If the ABP Suite did not generate the dropdown, you may need to re-add the navigation property and regenerate, ensuring you select the correct display and filter options.
References:
This approach aligns with common ABP conventions for one-to-many navigation properties in Angular UI.
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
-
0
I knew how to fix the code generated by apb suite. I hope you can fix apb suite so it generates correct code.