Embed tag using $scope variable containing url

I want to insert external URL into views embed tag using Angular 1.3 controller’s scope variable.
In controller I tried:

  $scope.printUrl = "http://example.net";

  $scope.printUrl = $sce.trustAsResourceUrl("https://example.net");

  $scope.printUrl = $sce.trustAsUrl("https://example.net");

And in view:

    <embed width="800px;" height="450px;" ng-bind-html="{{printUrl}}">

<embed width="800px;" height="450px;" src="{{printUrl}}">

<embed width="800px;" height="450px;" ng-src="{{printUrl}}">

Case with src works as i can see message:

Cannot GET /%7B%7BprintUrl%7D%7D

I read also on w3schools, that

The tag is new in HTML5, and will validate in an HTML5 page.


Source: html5

Leave a Reply