compile与link区别
来源:互联网 发布:淘宝宝贝电脑端描述 编辑:程序博客网 时间:2024/05/10 17:07
compile函数的作用是对指令的模板进行转换。
link的作用是在模型和视图之间建立联系,包括在元素上注册事件监听。elem.on('change',funcion(){...})
scope在link阶段才会被绑定到元素上,所以在compile阶段操作scope会报错。
对于同一个指令的多个实例,compile只会执行一次;而link对于指令的每个实例都会执行一次。
一般情况下我们只要编写link函数就够了。
注意:若编写了自定义的compile函数,自定义的link函数无效,因为compile函数应该返回一个ilnk函数供后续处理
0 0
- compile与link区别
- angular之link和compile的区别
- angular中compile和link的区别
- Angularjs link和compile使用区别
- angularjs compile和link的区别
- angular之link和compile的区别
- Compile,Build/Link和Execute((编译、连接和运行))的联系与区别
- COMPILE && LINK
- compile,link与run的详细解析
- compile函数与link函数用法
- angularjs指令中的compile与link函数详解
- angularjs指令中的compile与link函数详解
- AngularJS指令中的compile与link函数解析
- angularjs指令中的compile与link函数详解。
- angularjs指令中的compile与link函数详解
- angularjs指令中的compile与link函数详解
- angularjs指令中的compile与link函数详解
- Symbolic link 与 Hard link 的区别
- 流体布局FlowLayout
- POJ 3264Balanced Lineup (线段树基础)
- 婚姻默想(一)、(二)
- 《书都不会读,你还想成功》
- 基础知识之nginx重写规则
- compile与link区别
- leetCode练习(35)
- 树莓派之网络设置
- 字符串反转
- Struts2自学入门(五)——OGNL
- Hdu 3709 Balanced Number
- 单例模式
- 杂记 (3) —— C and linux
- Codeforces 50A(往矩形里填多米诺骨牌)