<tr *ngFor="let row of categories ">
<td>{{row.categoryName}}</td>
<td>{{row.visible}}</td>
<td>{{row.instanceNumber}}</td>
<td> <a class="btn btn-info btn-fill " [routerLink]="['/control/category']">Modify</a>
</td>
When attempting to send the row/category object along with the routing, I find myself redirected to an empty form. My goal is to map the current row data to the original form so that I can modify only specific fields rather than all.
In my Angular application, I utilize formbuilder!
ngOnInit() {
this.relationForm = this.fb.group({
relationName: ['', [Validators.required, Validators.minLength(3), Validators.pattern('[a-z]+([A-Z][a-z]*)*') ]],
humanFormat: ['', [Validators.required, Validators.minLength(3)]],
populate: ['', [Validators.required, Validators.pattern('TRUE|FALSE')]],
visible: ['', [Validators.required, Validators.pattern('TRUE|FALSE')]],
generalizations: ['', [Validators.required, Validators.minLength(3),Validators.pattern('[a-z]+([A-Z][a-z]*)*') ]],
I understand that I need to use something like this, but the where and how remain a bit unclear!
this.productForm.patchValue({
productName: this.product.productName,
productCode: this.product.productCode,
starRating: this.product.starRating,
description: this.product.description
});
this.productForm.setControl('tags', this.fb.array(this.product.tags || []));