export class ProductImage {
fileType: string;
fileContents: string;
};
Когда я пытаюсь использовать вышеуказанный класс в компоненте продукта.
export class ProductComponent implements OnInit {
tileView = false;
isProductListEmpty = true;
token = localStorage.getItem('token');
productImage :ProductImage;
constructor(public dialog: MatDialog, private productService : DesignerProductService) { }
ngOnInit(): void {
this.getDesignerProductList();
this.productImage.fileType = "a";
console.log(this.productImage.fileType);
}
, я получаю следующую ошибку
product.component. html: 50 ERROR TypeError: Cannot set property 'fileType' of undefined
Похоже, я делаю глупую ошибку, я новичок в angular ... что не так с объявлением?