How to pass variable in iframe?

Hi everyone, I want to display a video with an iframe but I don’t know how to get the url from my ts.
What is the good syntax to pass the vines.embed_url in the src ?
This is my code below:

35

Thanks !!

Hi, @mexraccoon,

you just need to change css of your card.here is reference code.

<ion-card class="card">
    <ion-card-header>
      / / YOUR HEADER
    </ion-card-header>
    <ion-card-content>
       // YOUR CONTENT
    </ion-card-content>
  </ion-card>

and then put css like this.

.card{
        position: absolute;
        top: 20px;
    }

And remove your iframe from ion-card.

But I need my iframe to be in the ion-car to get the value from my ngFor
It’s just I don’t succeed to pass variable in the iframe’s src=""
Do you know the syntax?

hello,

maybe property binding instead interpolation works

src=vines.embed.url

Best regards, anna-liebt

Have you checked the debugger?

I imagine there is a message talking about SafeResoureURL or something similar. If this is the case, read up on DOM sanitization using Angular’s DOMsanitizer

If you are going to use property binding, src should look like [src].

Hi thanks for your replies,
I have finally suceeed in using DomSanitizer to secure the url

sanitize(vid){
    return this.dom.bypassSecurityTrustResourceUrl(vid);
  }
  
1 Like

Wonderful! Glad I could help.

Hi, I’m having same issue here… can u help me with the solution?