zoukankan      html  css  js  c++  java
  • angularJS插入html及更换iframe的src

    html:

    ng-bind-html


    <div class="tabs_content" ng-bind-html="specialHtml"></div>

    ng-src

    <iframe id="iframe-projects" onload="set(this)" ng-src="{{trustSrc}}" frameborder="0"></iframe>

    加载模块:

    ng-bind-html


    angular.module('DLPortalApp', []).controller("MyCtrl", function ($scope, $http, $sce) { //重点列表项目 $scope.specialHtml = $sce.trustAsHtml('<iframe id="iframe-projects" onload="set(this)" src="你的地址" frameborder="0"></iframe>'); });

    /*重点:
    $sce这个参数,它相当于一把钥匙
    */

    ng-src

    angular.module('DLPortalApp', []).controller("MyCtrl", function ($scope, $http, $sce) {
        
        //重点列表项目
        $scope.trustSrc = $sce.trustAs($sce.RESOURCE_URL,"你的地址");
    //$scope.trustSrc = $sce.trustAsResourceUrl("你的地址");//等同于这个方法 });
  • 相关阅读:
    ASP.NET Core 静态资源的打包与压缩
    算法
    字符串反转
    js 获取随机数
    AspNetCore MVC 跨域
    add digits
    1-bit and 2-bit Characters
    删除字符串中出现次数最少的字符
    洗牌
    哈夫曼编码
  • 原文地址:https://www.cnblogs.com/LessIsMoreZ/p/7066848.html
Copyright © 2011-2022 走看看