这是我的代码 model.ts
export class Customer {
customer_id :number
firstname : string
lastname : string
email : string
telephone : number
password : string
}
component.ts
resetForm(form? : NgForm)
{
if(form!=null)
form.reset();
this.customerService.selectedCustomer=
{
customer_id : null,
firstname :'',
lastname :'',
email :'',
password:'',
telephone: //i want to pass 10 digit no here
}
我想将电话号码以角度5传递给webapi。如何实现
答案 0 :(得分:0)
将模型类更改为以下
export class Customer {
customer_id :number
firstname : string
lastname : string
email : string
telephone : string
password : string }
您可以将其作为字符串值传递给控制器。
那么将来即使数字的格式发生变化,也很容易发布。
resetForm(form? : NgForm)
{
if(form!=null)
form.reset();
this.customerService.selectedCustomer=
{
customer_id : null,
firstname :'',
lastname :'',
email :'',
password:'',
telephone: ''
}