HI,
In my app I face a problem every time I declare a interface or a class using the @Input() decorator at the top of my components.
Example: Not Working
export class UserDisplayPage{
@Input()
user: User;
}
After much testing I figured that if I assigned a value for my declarations it works fine.
Like this
export class UserDisplayPage{
@Input()
user: User = {“id”:0, “name”:“Tom”};
}
This looks very similar to the following issue I found on line.
https://github.com/angular/angular-cli/issues/2034
The interface file looks like this.
export interface User{
id: number,
name: string
}
I also tried by exporting the interface as a class. No luck there as well.
Just wanted to know if I am missing some thing here. Since the User interface that I use has more fields (sample here has been shown with just 2 fields.) it becomes impractical to assign dummy values in each component when i declare the user with the @Input decorators.
I use the “User” interface to show information on load of component.
Any advice is much appreciated.
Cheers,
SD