博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AngularJS directive 指令相关记录
阅读量:7282 次
发布时间:2019-06-30

本文共 741 字,大约阅读时间需要 2 分钟。

....

.directive('scopeDemo',function(){

  return{

    template: "<div class='panel-body'>Name: <input ng-model=name /></div>",

    scope:true  // 设置scope属性为true将允许我在同一个控制器里复用这个指令

    scope:{}  //创建一个隔离的作用域

     scope:{local: "=nameprop" ,cityFn: "&city" } // local属性的值以一个@字符作为前缀,指定了属性local的值应该从一个来自名为nameprop的特性的双向绑定来获得       //前缀 & 告诉AngularJS 我想将所指定特性的值绑定到一个函数
   scope:{local: "@nameprop"}  // local属性的值以一个@字符作为前缀,指定了属性local的值应该从一个来自名为nameprop的特性的单向绑定来获得           transclude: true // 设置transclude为true后,会对指令所应用到的元素内容进行包装,但并不是元素本身。如果想包含进元素,就需要将transclude属性      设置为element。        require: "^productTable" //require定义对象属性用于声明对控制器的依赖

  }

})

可用于require属性值勤的前缀
前缀 描述
None   asf
^ asdf
? adf

转载于:https://www.cnblogs.com/thomaspha/p/6181438.html

你可能感兴趣的文章
myeclipse如何修改Web项目名称
查看>>
TCP/UDP
查看>>
ssh无密码连接基本知识
查看>>
ESLint使用文档
查看>>
Eclipse常用的优秀插件在线更新地址,包括MyEclipse10.0
查看>>
Redis事务
查看>>
Jquery easyui中tabs新建标签设置href会提交两次请求
查看>>
springboot(九):定时任务
查看>>
is null为判断条件
查看>>
根据注解访问路径的写法 的4种写法
查看>>
突击一下C语言
查看>>
erlang判定闰年,并用eunit测试
查看>>
DatetimeUtil工具类--用于Date和字符串互转的工具类
查看>>
escape()、encodeURI()、encodeURIComponent()区别详解
查看>>
GitLab 7.13.x安装和配置<二>--Linux篇
查看>>
mybatis调用oracle存储过程
查看>>
shell练习五
查看>>
踩坑Apache HttpEntity
查看>>
Core Data的使用(二)
查看>>
MYSQL外键(Foreign Key)的使用
查看>>