-->

How to bind dynamic data to ARIA-LABEL?

2019-02-12 00:55发布

问题:

I have dynamic text to bind to ARIA-LABEL on an html page. This is an angular 2 app. I am using something like this: aria-label="Product details for {{productDetails?.ProductName}}"

But I get an error - Can't bind to 'aria-label' since it isn't a known property of 'div'.

Is there any workaround for this?

回答1:

Just use attr. before aria-label:

attr.aria-label="Product details for {{productDetails?.ProductName}}"