html:
<div class="tabs_content" ng-bind-html="specialHtml"></div>
<iframe ></iframe>
加载模块:
angular.module('DLPortalApp', []).controller("MyCtrl", function ($scope, $http, $sce) {- //重点列表项目
- $scope.specialHtml = $sce.trustAsHtml('<iframe ></iframe>');
- });
/*重点:
- $sce这个参数,它相当于一把钥匙
- */
- angular.module('DLPortalApp', []).controller("MyCtrl", function ($scope, $http, $sce) {
- //重点列表项目
- $scope.trustSrc = $sce.trustAs($sce.RESOURCE_URL,"你的地址");
//$scope.trustSrc = $sce.trustAsResourceUrl("你的地址");//等同于这个方法- });
以上就是angularJS插入html及更换iframe的src的详细内容,更多关于angularJS插入html及更换iframe的src的资料请关注九品源码其它相关文章!