Conditionally adding data-attribute in Angular directive template

I think a good way could be to use ng-attr- followed by the expression you want to evaluate.
In your case it would be something like:

<span ng-attr-data-toggle="{{ isValueTrue ? 'toggle' : 'notToggle' }}"></span>

Here’s a fiddle with an example.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)