scope重定义
2024-10-15 08:50:39
.directive('myAttr', function() {
return {
restrict: 'E',
scope: {
customerInfo: '=info'
},
template: 'Name: {{customerInfo.name}} Address: {{customerInfo.address}}<br>' +
'Name: {{vojta.name}} Address: {{vojta.address}}'
};
});
directive中的几个属性:
restrict
E: 表示该directive仅能以element方式使用,即:<my-dialog></my-dialog>
A: 表示该directive仅能以attribute方式使用,即:<div my-dialog></div>
EA: 表示该directive既能以element方式使用,也能以attribute方式使用:transclude:你的directive可能接受页面上的其他html内容时才会用到,建议你先去掉该参数。有些高阶了。
scope:当你写上该属性时,就表示这个directive不会从它的controller里继承$scope对象,而是会重新创建一个。
templateUrl:你的directive里的html内容
link:可以简单理解为,当directive被angular 编译后,执行该方法
最新文章
- table中的th td margin不生效
- 关于OC中的block自己的一些理解(一)
- wpf,ListBox,ScrollViewer内容向左向右偏移指定位置
- Burning Bridges-ZOJ1588(割边求解)
- [Android] 转移“植物大战僵尸2”存档的办法,无需root
- 注意64位整形,int64,long long
- <;转>;Python学习推荐
- SYN, FIN, ACK, PSH, RST, URG
- 高德JAVA笔试题
- C++11 : 外部模板(Extern Template)
- JDBC开发
- Myeclipse程序调试快捷键及步骤详解
- 腾讯云数据库团队:MySQL语句复制(SBR)的缺陷列举
- (python功能定制)复杂的xml文件对比,产生HTML展示区别
- Oracle知识梳理(一)理论篇:基本概念和术语整理
- symfony简单的博客练习,熟悉具体开发流程
- 解决'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
- uboot1.1.6
- 面板 JPanel,滚动面板 JScrollPane,文本域JTextArea
- Path类对路径字符串的操作
热门文章
- 关于Js脚本的延迟执行
- Shell统计报表表格生成
- DelphiXE Android的所有权限按照分类总结说明
- Gym 100507D	Zhenya moves from the dormitory (模拟)
- zoj 1610 Count the Colors
- Codeforces Round #359 (Div. 2) C. Robbers&#39; watch (暴力DFS)
- HDU 5832 A water problem (水题,大数)
- Thinkphp框架----微信公众测试号开发
- Unity的使用
- ASP.NET MVC 3 入门级常用设置、技巧和报错