cant bind to property angular

Can’t bind to ‘product’ since it isn’t a known property of ‘app-product’

While running your Angular project you might see the following error like “Can’t bind to ‘product’ since it isn’t a known property of ‘app-product‘”. If you get template parse errors as shown below

Solution for Can’t bind to property error

Look at the first point below the error

1. If ‘app-product’ is an Angular component and it has ‘product’ input, then verify that it is part of this module

Open the specific component (in this case “product.component.ts“) file and check whether your property “X” ( in this case it is “product”) defined in your component with @Input() decorator.

In the above code the property ‘product‘ is not defined with @Input() decorator. Try to do the following changes, first update your import statement to include “Input” from “@angular/core” and add @Input() decorator for “product” property as shown below

Once you made those changes, the code should get compiled successfully and run. Hope this resolves your issue 🙂

Related Posts


Leave a Reply

Notify of