angularJS1自定义directive指令的创建方式
来源:互联网 发布:淘宝买家诈骗怎么办 编辑:程序博客网 时间:2024/05/20 04:32
angularJS中一些重复用的模板,可以封装起来,用这种自定义指令的方法实现。demo如下:
<html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" /> <script type="text/javascript" src="js/angular.min-1.6.x.js"></script> </head> <body ng-app='myapp1' > <cus></cus> </body> <script type="text/javascript"> var app = angular.module('myapp1', []); app.directive("cus",function(){ return { restrict:'E',//'E':element元素 调用时:<cus></cus> //'A':attribute属性 调用时<div cus></div> //'C':class类 调用时<div class='cus'></div> replace:true,//默认false,替换掉自定义的directive的名称 template:'<div>Hello world</div>', link:function(){ alert('显示在这里呢!'); console.log('显示在这里呢!'); } } }); </script></html>
0 0
- angularJS1自定义directive指令的创建方式
- directive-自定义指令的方法.md
- 自定义指令(directive)
- Angular2-自定义指令@Directive
- Vue.directive 自定义指令
- Vue自定义指令(directive)
- 自定义指令-directive
- Vue.directive 自定义指令
- angular2采用自定义指令(Directive)方式加载jquery插件
- Vue2 自定义全局指令Vue.directive和指令的生命周期
- 自定义指令[directive,link,complie]
- angular 自定义指令详解 Directive
- angular 自定义指令 Directive(详解)
- angular 自定义指令详解 Directive
- angular 自定义指令详解 Directive
- angular中的自定义指令directive
- Angularjs自定义指令(directive)
- angularjs的自定义directive指令的绑定策略scope:”@”、”=”、”&”
- caffe源码阅读——Blob类
- java 多线程学习笔记2-同步代码块,死锁
- SVM总结
- 互联网数据库架构设计思路数据库
- Longest Substring Without Repeating Characters
- angularJS1自定义directive指令的创建方式
- 【微信小程序】注册一个微信小程序
- java类加载
- [回归分析][13]--岭回归
- 菜鸟C#学习记录:简单使用一个ListView控件
- hdu 4315 Climbing the Hill (阶梯博弈)
- okhttp的简单使用(一)
- Python学习笔记
- MySQL案例一