Using angularjs variable inside iframe

前端 未结 2 696
心在旅途
心在旅途 2021-01-23 23:46

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 `



        
2条回答
  •  半阙折子戏
    2021-01-24 00:25

    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.

提交回复
热议问题