I want to display a changed text value only if a Button has been clicked. The text value depends on an input field, and is dynamically bound to the input value of the text field with [(NgModel)]="textValue"...
I first enter some ID number into the input box and it directly changes my text. But I only want the text with the "ID-value" to change after I clicked the button, and called the new charts data with my function "getChartsData()".
This is how my html looks like:
<input [(ngModel)]="monatConst" placeholder="Demonstrator-ID">
<button class="btn btn-danger float-xl-right mt-1"
(click) = "getChartsData()"> Call HTTP Request
</button>
<br>
<div *ngIf="monatConst">Chart für Demonstrator mit ID: {{monatConst}} </div><br>
<ngx-charts-bar-vertical
[view]="view"
[scheme]="colorScheme"
[results]="dataArray"
[gradient]="gradient"
[xAxis]="showXAxis"
[yAxis]="showYAxis"
[legend]="showLegend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel">
</ngx-charts-bar-vertical>
How can I best realize that the text with the ID field is only changed after clicking the button, and calling the new charts data? For the moment, I bound the ID variable two way with ngModel and put it directly into the text field with data binding {{..}}