加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

AngularJs directive-transclude

发布时间:2020-12-17 10:07:33 所属栏目:安全 来源:网络整理
导读:transclude制定是否复用标签内部的html 制定方式是将当前标签内部内容,复制一份到template中制定 ng-transclude的元素内部 1.代码: body ng-app="myApp" my-site p class="text-danger"原始的内容/p /my-site/body //transclude 是否复制原来控件内容,到

transclude制定是否复用标签内部的html

制定方式是将当前标签内部内容,复制一份到template中制定 ng-transclude的元素内部

1.代码:

<body ng-app="myApp">
    <my-site>
        <p class="text-danger">原始的内容</p>
    </my-site>
</body>
//transclude 是否复制原来控件内容,到 ng-transclude 的元素内部
var app = angular.module('myApp',[]);
app.directive('mySite',function () {
    return {
        restrict: 'E',template: '<strong>重点内容</strong><div ng-transclude></div>',transclude: true
    };
});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读