-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
angularjs指令--指令创建 #1
Labels
javascript
跟js相关的笔记
Comments
29 AngularJS Interview Questions – Can You Answer Them All?1. 对angular的filter过滤器进行单元测试的基本步骤?
2.watches存放最大的数量是多少,怎么保持一个可观的数量?
3.控制器之间怎么传递数据?
4.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
指令(Directives)是所有AngularJS应用最重要的部分。尽管AngularJS已经提供了非常丰富的指令,但还是经常需要创建应用特定的指令。
自定义指令
指令可以有四种表现形式,分别为元素(element)、属性(attribute)、注释(comment)、样式类(class),正好代表ECMAScript的前四个字母,还是很好记的。基本样式如下:
使用app.directive()方法在模块中注册一个新的指令,第一个参数是指令的名称,第二个参数是返回指令定义对象的函数;如果你的指令依赖于其他的对象或者服务,比如 $rootScope, $http, 或者$compile,他们可以在这个时间被注入。
页面使用形式:
部分属性说明:
angularjs深度学习参考
The text was updated successfully, but these errors were encountered: