自定义指令
来源:互联网 发布:知乎 swatch秒针掉了 编辑:程序博客网 时间:2024/06/06 13:17
使用驼峰法来命名一个指令, runoobDirective, 但在使用它时需要以 - 分割, runoob-directive
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body ng-app="myApp"><runoob-directive></runoob-directive><script> var app = angular.module("myApp", []); app.directive("runoobDirective", function() { return { restrict : "E", template : "<h1>自定义指令!</h1>" }; });</script></body></html>
restrict 值可以是以下几种:
- E 作为元素名使用
- A 作为属性使用
- C 作为类名使用
- M 作为注释使用
restrict 默认值为 EA, 即可以通过元素名和属性名来调用指令。通过添加 restrict 属性,并设置只值为 “E”, 来设置指令只能通过元素名的方式来调用
0 0
- 自定义指令
- 自定义指令
- 自定义指令
- 自定义指令
- 自定义指令
- 自定义指令
- 自定义指令
- 自定义指令
- Angular2 指令—自定义指令
- angular指令和自定义指令
- Angular2 指令—自定义指令
- freemarker的自定义指令
- FreeMarker自定义指令
- angularJS自定义指令
- angular 自定义指令
- freemarker 自定义指令
- AngularJS自定义指令标签
- 创建自定义指令[进阶]
- C-运算符优先级一个小例子
- 最大流模板1
- session_set_save_handler()函数注意细节
- cocos2dx shader在android上失效
- SQL的Join
- 自定义指令
- Test
- URL参数解析
- 行人检测资源
- 【9月软件测试公开课】Parasoft c++test、黑盒测试、LoadRunner三大课程覆盖软件测试全过程
- css实现容器高度 适应 屏幕高度
- Exception
- mysql 行转列
- svn工具使用