gpt4 book ai didi

angular - 指定值无法解析,或使用数字管道时超出范围

转载 作者:行者123 更新时间:2023-12-04 08:26:36 24 4
gpt4 key购买 nike

The specified value cannot be parsed, or is out of range


当我得到我的对象时,我用管道格式化一个数字,但它返回此警告并且不显示该值。如果我删除它,它会显示出来。
这不显示值
  <input name="value" [ngModel]="value | number : '1.2-2'"/>
这显示值
  <input name="value" [ngModel]="value"/>
TS
在这里,我在列表中选择它后通过它的 id 获取我的对象。
  ngOnInit(){
this.get();
}

get() {
this.service.get(this.id).subscribe(
(data) => {
this.object = data;
this.name = this.object.name;
this.value = this.object.value;
},
(error) => {
console.log(error);
}
);
}
该值是一个数字,我在控制台中得到它没有任何问题。

最佳答案

<input [value]="units * 600 + 2500 | number" readonly type="text" name="grandtotal"
class="form-control" id="grandtotal" placeholder="Grand Total">
我发现我的解决方案在这里更改或替换 HTML type="text" 中的类型

关于angular - 指定值无法解析,或使用数字管道时超出范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65231352/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com