使用包含url的$ scope变量嵌入标记

时间:2015-10-05 08:34:16

标签: angularjs html5

我想使用Angular 1.3控制器的范围变量将外部URL插入到视图嵌入标记中。 在控制器中我试过:

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

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

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

并且在视野中:

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

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

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

src的情况正常,因为我可以看到消息:

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

我也读过w3schools,

  

标记是HTML5中的新标记,将在HTML5页面中验证。

更新

http://plnkr.co/edit/yDAYclWzTQNMKlzqwEGX?p=preview

0 个答案:

没有答案
相关问题