<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>
Here i want to send the row/category object along with the routing, but i'm redirected to an empty form! i want to map the current row data to the original form so that i can modify only some fields not all.
I use formbuilder in angular!
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 know i have to use something like this but where and how is the question!
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 || []));