您好,我在将ngForm
转换为interface
时遇到麻烦。它总是导致undefined object
。
提交事件
onSubmitClicked(data:NgForm):void{
console.log("submit form:");
console.log(data); //looks exactly like the interface
var x:User=data.value;
var y=data.value as User;
console.log(x); //undefined
console.log(y); //undefined
this.userservice.createClientAsync(x);
}
模型
export interface User{
id:number;
name:string;
age:number;
cnp?:string;
children?:number;
isMarried?:boolean;
}