Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

data binding in AOS – possible?

I’m using Animate On Scroll in my angular poject, I have a bunch of images, that I want to reveal one after the other.

 <div class="img-gallery">
        <div *ngFor="let imgSrc of images" data-aos="zoom-in">
            <img [src]="imgSrc">
        </div>
    </div>

I wanted to add th each wrapper div the data-aos-delay directive, like this

<div *ngFor="let imgSrc of images; let i = index" data-aos="zoom-in" [data-aos-delay]="i * 100">
    <img [src]="imgSrc">
</div>

but, expectedly – it shows me the error

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Can’t bind to ‘data-aos-delay’ since it isn’t a known property of ‘div’

How can I implement it anyhow? any implementation will be accepted gratefully

>Solution :

Could you change it to below

You also have a typo on index

<div *ngFor="let imgSrc of images; let i = index" data-aos="zoom-in" data-aos-delay="{{i * 100}}">
    <img [src]="imgSrc">
</div>

You can also do like this

<div *ngFor="let imgSrc of images; let i = index" data-aos="zoom-in" [attr.data-aos-delay]="i * 100">
    <img [src]="imgSrc">
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading