I want to write a function with get two values from two inputs and calculate something like BMI (Body Mass Index). My HTML file:
<div class="input-group mb-3 weight-div col-6">
<div class="input-group-prepend">
<span class="input-group-text">Weight</span>
</div>
<input ng-model="weight" type="text" class="form-control" placeholder="[kg]" aria-label="Waga[kg]" aria-describedby="basic-addon1">
</div>
<div class="input-group mb-3 growth-div col-6">
<div class="input-group-prepend">
<span class="input-group-text">Growth</span>
</div>
<input ng-model="growth" type="text" class="form-control" placeholder="[m]" aria-label="Wzrost[m]" aria-describedby="basic-addon1">
</div>
<button (click)="calculate()" type="button" class="btn btn-primary btn-sm ml-3">Large button</button>
<div class="alert alert-dark" id="result" role="alert">
</div>
My TS file:
import { Component, OnInit } from '@angular/core';
import { NgModel } from '@angular/forms';
@Component({
selector: 'app-inputs',
templateUrl: './inputs.component.html',
styleUrls: ['./inputs.component.css'],
})
export class InputsComponent implements OnInit {
constructor() { }
ngOnInit() {
}
calculate() {
}
}
What should I write in function calculate () to see get values from weight and growth inputs and how can I export for example value from variable bmi to div id="result" ? Thanks for help!