合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
> 注意: 1.要在localhost里运行文件 2.使用replace:true,替换属性里面的内容时,templateUrl的模板中要写div > transclude:true 定义的template可以与元素中的数据并和 ~~~ <div ng-controller="a"> <div i-yyan>AVC</div> </div> ------------------------------------------------------------ var a = angular.module('model', []); a.directive('iYyan', function () { return { restrict: 'AE',//a Attr标签,E Element元素,c Class样式 template: "<h1><div ng-transclude=''></div>nihao</h1>", transclude:true, } }); ~~~ > templateUrl ~~~ <div ng-controller="a"> <div i-yyan>AVC</div> </div> ------------------------------------------------------------ var a = angular.module('model', []); a.directive('iYyan', function () { return { restrict: 'AE',//a Attr标签,E Element元素,c Class样式 templateUrl:"view/iYyan.html", transclude:true, replace:true } }); ~~~