.directive('myAttr', function() {
return {
restrict: 'E',
scope: {
customerInfo: '=info'
},
template: 'Name: {{customerInfo.name}} Address: {{customerInfo.address}}<br>' +
'Name: {{vojta.name}} Address: {{vojta.address}}'
};
});
directive中的几个属性:
  1. restrict
    E: 表示该directive仅能以element方式使用,即:<my-dialog></my-dialog>
    A: 表示该directive仅能以attribute方式使用,即:<div my-dialog></div>
    EA: 表示该directive既能以element方式使用,也能以attribute方式使用

  2. :transclude:你的directive可能接受页面上的其他html内容时才会用到,建议你先去掉该参数。有些高阶了。

  3. scope:当你写上该属性时,就表示这个directive不会从它的controller里继承$scope对象,而是会重新创建一个。

  4. templateUrl:你的directive里的html内容

  5. link:可以简单理解为,当directive被angular 编译后,执行该方法

最新文章

  1. table中的th td margin不生效
  2. 关于OC中的block自己的一些理解(一)
  3. wpf,ListBox,ScrollViewer内容向左向右偏移指定位置
  4. Burning Bridges-ZOJ1588(割边求解)
  5. [Android] 转移“植物大战僵尸2”存档的办法,无需root
  6. 注意64位整形,int64,long long
  7. &lt;转&gt;Python学习推荐
  8. SYN, FIN, ACK, PSH, RST, URG
  9. 高德JAVA笔试题
  10. C++11 : 外部模板(Extern Template)
  11. JDBC开发
  12. Myeclipse程序调试快捷键及步骤详解
  13. 腾讯云数据库团队:MySQL语句复制(SBR)的缺陷列举
  14. (python功能定制)复杂的xml文件对比,产生HTML展示区别
  15. Oracle知识梳理(一)理论篇:基本概念和术语整理
  16. symfony简单的博客练习,熟悉具体开发流程
  17. 解决'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
  18. uboot1.1.6
  19. 面板 JPanel,滚动面板 JScrollPane,文本域JTextArea
  20. Path类对路径字符串的操作

热门文章

  1. 关于Js脚本的延迟执行
  2. Shell统计报表表格生成
  3. DelphiXE Android的所有权限按照分类总结说明
  4. Gym 100507D Zhenya moves from the dormitory (模拟)
  5. zoj 1610 Count the Colors
  6. Codeforces Round #359 (Div. 2) C. Robbers&#39; watch (暴力DFS)
  7. HDU 5832 A water problem (水题,大数)
  8. Thinkphp框架----微信公众测试号开发
  9. Unity的使用
  10. ASP.NET MVC 3 入门级常用设置、技巧和报错