Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

So I want to use a variable inside a iframe src or ng-src attribute. Apparently none of my variables get ever recognized, whatever I use. For example <iframe ng-src="http://www.example.com/?name={{test}}"></iframe> where test just get displayed as {{test}} ....

Also when I use $sce to use it as a trusted url it doesn't work, same goes for normal src..

Is there something I don't see? Is there something about Iframes and angularjs? Please share, its really annoying.

Thnx in advance.

share|improve this question

1 Answer 1

You can try this, In your controller do - replace the ng-src="{{test}}" -- use a variable for the whole url. and then - $scope.test=$sce.trustAsResourceUrl("https://www.example.com"); also include $sce in your controller dependency. It worked for me.. Hope it helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.