Angular js scope var value in iframe

后端 未结 1 1131
梦谈多话
梦谈多话 2020-12-11 06:43

I am working with angular js . I have a controller \"youTubePlayerCtrl\", in this controller i have $scope.videoID which contains the youtube video id. I am able to get this

相关标签:
1条回答
  • 2020-12-11 07:19

    First: you need to use ng-src instead of src as @Cherniv suggested in a comment to your question. Read more here.

    Second: you cannot concatenate the URL inside the source attribute for security reasons: you must concatenate the URL in Javascript in a scope variable e.g. fullURL and then ng-src="{{fullURL}}". Read more here.

    Third: if Strict Contextual Escaping (SCE) is enabled ‒ and Angular v1.2 ships with SCE enabled by default ‒ you need to whitelist the URLs. Read more here and here.

    0 讨论(0)
提交回复
热议问题