I have a simple form in angular2 where the object which i pass to create the form should be of interface type...I have made a small plunker demo here http://plnkr.co/edit/GXyZfXenDcDLiCWwjfYN?p=preview ...If the object passed is of type null then i want to call new instance but it is not happening... Is it possible to call new instance for interface...
interface Cust {
label: string;
}
This is my interface and below is how i am calling new instance in my component
Create(data:Cust){
if(data==null){
data=new Cust();
}
this.myForm = this.localfb.group({
'sku': [data.label, Validators.required]
});
}
Somebody please guide me in the right direction...