URL sanitization is causing refresh of the embedded YouTube video

后端 未结 5 1193
春和景丽
春和景丽 2021-02-02 06:15

I have a problem with my AngularJS 2 app (I am using RC5 version of AngularJS 2). It seems that a sanitized URL is triggering change detection which then updates the div

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-02 06:48

    Figured it out.

    For anyone interested. The problem was the use of this function in my html

       [src]="getTrustedYouTubeUrl(item)"
    

    The reload side effect was gone once I changed the code to calculate the safe url when the data is loaded in my service and changed the iframe binding to this

            
    

    Note thatr I am now binding to a property.

提交回复
热议问题