'Cannot bind array data to Lightbox attribute
gallery1.url binds to the href attribute perfectly but gallery1.ref_id does not bind data to the data-lightbox attribute, but if I use that same gallery1.ref_id inside of an HTML paragraph tag it shows data perfectly. what am I doing wrong?
<a
href="{{ gallery1.url }}"
data-lightbox="{{ gallery1.ref_id }}"
data-title="Caption8"
>
<img
src="{{ gallery1.url }}"
alt="image"
style="width: 100%"
/>
</a>
Solution 1:[1]
As @MikeOne mentioned in the comment this method works perfectly.
[attr.data-lightbox]= "gallery1.ref_id"
Full example:
<a
href="{{ gallery1.url }}"
[attr.data-lightbox]= "gallery1.ref_id"
data-title="Caption8"
>
<img
src="{{ gallery1.url }}"
alt="image"
style="width: 100%"
/>
</a>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hishan_98 |
