angular attrs.$observe和$scope.$watch的区别
来源:互联网 发布:学生成绩管理系统c语言 编辑:程序博客网 时间:2024/05/22 00:18
http://stackoverflow.com/questions/14876112/difference-between-the-observe-and-watch-methods
https://docs.angularjs.org/api/ng/type/$compile.directive.Attributes
$observe()是Attributes 对象的一个方法,它只能用于observe/watch一个DOM attribute的value change.它只在directive内部被调用。当你需要监察、侦听一个包含interpolation的attribute的DOM时,你需要使用$observe()函数(比如:{{attrValue}},再比如select控件,当你选择一个option时,如果对应的属性作为触发过滤结果集这种场景时,可以$observe这个选择动作的结果(作为attr)
<div d1 attr1="{{prop1}}-test" attr2="prop2" attr3="33" attr4="'a_string'" attr5="a_string" attr6="{{1+aNumber}}"></div>
$watch被用于监察、侦听一个model/scope属性,比如:scope.$watch(attrs.attr1)...
注意:angular normalize string
阅读全文
0 0
- angular attrs.$observe和$scope.$watch的区别
- Angular的侦察兵:$watch()和$observe()
- Angular中$scope的$watch
- angular中$scope.$apply和$scope.$digest的区别
- $parse/$eval和$observe/$watch如何区分
- $parse/$eval和$observe/$watch如何区分
- $parse/$eval和$observe/$watch如何区分
- $parse/$eval和$observe/$watch如何区分
- $parse/$eval和$observe/$watch如何区分
- 工作学习记录--angularjs 中的$watch与$observe监听区别
- angular的watch监听
- angular的$watch 函数
- Angularjs $scope 里面的$apply方法 和 $watch方法
- Angularjs $scope 里面的$apply 方法 和 $watch 方法
- [angular]服务之2$scope之$watch、$watchGroup、$watchCollection
- $scope.$watch
- angular中scope的用法
- angular的mvc模式($scope)
- #!/usr/bin/env python与#!/usr/bin/python的区别
- NgModelController: $setViewValue,$render,Formatter, Parser
- ROBOTICS2015 ORB-SLAM: a Versatile and Accurate Monocular SLAM System
- angular中的scope
- 通过cat /prco/driver/rtc 看到rtc的信息
- angular attrs.$observe和$scope.$watch的区别
- mobile webiste 中的css的font-size em及line-height等换算
- 【CUGBACM15级BC第11场 B】hdu 5055 Bob and math problem
- git internal for computer scientists
- 选择Code Style及Default Pro
- angularJS web应用SEO
- phantomjs rendering
- git多账户配置
- css中attribute selector及pseudo class