How to pass variable in iframe?

#1

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:

Thanks !!

#2

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;
    }
#3

And remove your iframe from ion-card.

#4

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?

#5

hello,

maybe property binding instead interpolation works

src=vines.embed.url

Best regards, anna-liebt

#6

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].

#7

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

sanitize(vid){
    return this.dom.bypassSecurityTrustResourceUrl(vid);
  }
  
#8

Wonderful! Glad I could help.