从Angular前端输入并提交整数输入值后,它将转换为十进制。有没有办法在前端以整数显示值?
代码在下面给出
component.ts
onSubmit() {
let postData = [];
for (var k in this.measures) {
if (!this.measures.hasOwnProperty(k)) { continue }
let secs = this.measures[k]
for (var i in secs) {
var item1 = secs["items"]
for (var j in item1) {
var item2 = item1[j]
for (var l in item2) {
var listItem = item2["items"]
for (var li in listItem) {
this.model = new MeasurementChange(listItem[li].id,
listItem[li].percent_complete);
postData.push(this.model);
}
}
}
}
component.html
<mat-form-field>
<mat-label>Enter Input</mat-label>
<input type = number [(ngModel)]="row.percent_complete"
[ngModelOptions]="{standalone: true}" id="percent_complete"
name="percent_complete" matInput placeholder="Enter Progress (%)">
</mat-form-field>
service.ts
postEntries(formData: Array<MeasurementChange>): Observable<any> {
return this.http.post(this.baseUrl + this.postDataUrl, formData);
}