How to implement the purchase HTML form?
<div class="d-flex justify-content-center align-items-center">
<div class="col-md-12 border">
<div class="card-header header-elements-inline">
<h4 class="card-title">Add Purchase</h4>
<button [mat-dialog-close]="true" type="button" class="bootbox-close-button close" data-dismiss="modal"
aria-hidden="true">×</button>
</div>
<form action="" #addPurchaseForm="ngForm" class="purchaseForm" (ngSubmit)="addPurchase(addPurchaseForm)" method="POST">
// Add your form fields here
</form>
</div>
</div>
Implementing the add purchase component:
import { Component, OnInit, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
import { NgForm } from '@angular/forms';
@Component({
selector: 'app-add-purchase',
templateUrl: './add-purchase.component.html',
styleUrls: ['./add-purchase.component.css']
})
export class AddPurchaseComponent implements OnInit {
// Initializing necessary variables
constructor(@Inject(MAT_DIALOG_DATA) private addPurchaseData : any) { }
ngOnInit() {
// Logic for initialization
}
// Function to add new purchase detail row
addNewPurchaseDetail(){
// Add logic here
}
// Function to remove a purchase detail row
removePurchaseDetail(index){
// Add logic here
}
}
Need help with adding new purchase details row without resetting values
Values are getting reset when adding new rows
Seeking guidance on the right approach
Newbie in Angular, looking for assistance
Values persist in console log but rows are getting reset, seeking solutions