How do I calculate the total ticket price when I adjust the number of individuals?
HTML Code :
<div class="row">
<div class="col-md-6">
<label for="person">Person</label>
<div class="form-group">
<input type="number" class="form-control" formControlName="person" id="input" (change)="countPrice($event)">
</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="price">Price</label>
<div class="form-group">
<input type="number" class="form-control" id="output" formControlName="price" (change)="countPrice($event)">>
</div>
</div>
</div>
Typescript Code:
onDestination(eve) {
this.http.post(environment.api_url + `/admin/get_price`, {
"from_city": this.r.from_city.value,
"to_city": this.r.to_city.value,
}).subscribe(data => {
console.log(data);
this.price = data['data']['price'];
console.log(this.price);
this.bookingForm.patchValue({
'price': this.price
});
})
}
countPrice(event) {
}
I am looking to display the total price by calculating it based on the number of people. I need assistance in retrieving the price from the previous change event. Any help would be greatly appreciated.