What\'s the best way to prevent errors in console from objects that are still undefined?
Let\'s say I have this
name : string;
constructor(private data:
You can use {{name?.value}} or {{name?}} inside component.html.
Can make treatment to like this in compoment.ts ↓
````
this.route.paramMap.pipe(
map((param: ParamMap) => {
// @ts-ignore
return param.params.id;
})
).subscribe(prodId => {
this.id = prodId;
this.productService.getSingleProduct(this.id).subscribe(prod => {
this.product = prod;
if (prod.images !== null) {
this.thumbimages = prod.images.split(';');
}`enter code here`
});
});
````