AngularJS directive 指令相关记录
2016-12-14 22:48
746 查看
....
.directive('scopeDemo',function(){
return{
template: "<div class='panel-body'>Name: <input ng-model=name /></div>",
scope:true // 设置scope属性为true将允许我在同一个控制器里复用这个指令
scope:{} //创建一个隔离的作用域
}
})
可用于require属性值勤的前缀
.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定义对象属性用于声明对控制器的依赖
}
})
前缀 | 描述 |
None | asf |
^ | asdf |
? | adf |
相关文章推荐
- Angularjs Directive(指令)机制
- Angularjs directive 指令复用,指令传参
- Angularjs Directive(指令)机制
- AngularJS directive指令之require部分
- Angular.js 相关记录
- angular.js基础(1)--指令directive
- ionic angularJS input 相关指令 以及定时器 的使用
- AngularJs directive指令实例
- angularjs directive指令 link在渲染完成之后执行
- AngularJS Directive指令
- AngularJS clone directive 指令复制
- angularjs directive and component 指令与组件 ( 1.5.0 以后 )
- angular.js学习(1)--directive指令独立scope
- angularjs directive 指令 学习笔记
- AngularJs directive指令详解
- AngularJS clone directive 指令复制
- AngularJS directive 实现分页包装指令
- angular directive实例第一发 jquery插件datepicker转化成指令
- angularjs directive 的几点使用技巧
- 推荐 15 个 Angular.js 应用扩展指令(参考应用)