angularJS自定义指令模板替换
2015-05-10 10:57
260 查看
<html> <head> <meta charset="utf-8"/> <title></title> </head> <body ng-app="components"> <myelement> <h1>哈哈</h1> </myelement> </body> <script src="angular.js"></script> <script> var app= angular.module('components', []); app.directive('myelement', function() { return { restrict: 'AE',//自定义属性和Dom节点 transclude: true,//将自定义指令内部原有的节点保留(这里注意,自定义指令中的内容在模板中必须有父节点) scope: {}, templateUrl:"templates/templateOther.html", replace: true,//全部替换 link:function(scope,element,attr){ element.bind("click",function(){ alert(1); }) } }; }); </script> </html>
相关文章推荐
- AngularJS自定义指令模板
- angularJS 使用自定义指令输出模板
- AngularJS入门教程(一):静态模板
- Angularjs标签模板加载原理
- AngularJS 动态模板
- java中使用String的replace方法替换html模板保存文件
- 20150327--Dede+模板替换-02
- AngularJS自定义指令
- AngularJS提供多种模板加载
- Begin_With_AngularJS(1)基础:ng-app,ng-controller,代码分离,模板,作用域等
- AngularJS入门教程之AngularJS 模板
- angularjs自定义指令
- Jacob模板替换生成word文件、word合并、word转pdf文件
- MessageFormat.format 字符串的模板替换
- POI对docx模板进行文字、图片替换
- POI Word 模板 文字 图片 替换
- 字符串模板替换方法 MessageFormat.format
- 走进AngularJs(四)自定义指令----(中)
- AngularJs自定义指令详解(10) - 执行次序
- 1、PCB替换模板