angular - Iframes automatically refresh when interacting with form - Ionic2/Firebase -
i making simple messaging app embeds multiple spotify widgets using iframe. url song stored in firebase , needs encoded & sanitized before displaying. when interact form widgets refresh. there way prevent refresh? believe issue fetching sanitized url using function, not know how fix.
constructor(public navctrl: navcontroller, public navparams: navparams, af: angularfire, messagedata: messageprovider, public channelprovider: channelprovider, public spotifyprovider: spotifyprovider, public authprovider: authprovider, public messageprovider: messageprovider, public sanitizer: domsanitizer, private formbuilder: formbuilder) { this.channel = navparams.data.channel || {$key: 1}; this.items = af.database.list('/channels/' + this.channel.$key); this.items.subscribe(x => { this.content && this.content.scrolltobottom(0) }); this.messageform = this.formbuilder.group({ message: ['', validators.required], }); } encodeuri(uri) { let url = `https://embed.spotify.com/?uri=${encodeuricomponent(uri)}`; return this.sanitizer.bypasssecuritytrustresourceurl(url); } <ion-row *ngif="item.detail?.spotifyuri" class="spotifyplayer"> <iframe [src]='encodeuri(item.detail.spotifyuri)' width="100%" height="380" frameborder="0" allowtransparency="true"></iframe> </ion-row>
Comments
Post a Comment