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

最新文章

  1. 如何参与一个 GitHub 开源项目?
  2. underscore.js依赖库函数分析一(遍历)
  3. 使用windows服务和MSMQ和进行日志管理(解决高并发问题)
  4. 深入认识JavaScript 中的this指针
  5. Linux查看日志命令
  6. DataTable Select 使用
  7. android的fragments管理
  8. Ecshop去掉模版中随机出现Ecshop版权的方法
  9. 51nod 1103 N的倍数 思路:抽屉原理+前缀和
  10. C语言编写一个简单游戏
  11. 源码解析flask的路由系统
  12. 某校高中生利用Python,巧妙获取考试成绩,看到成绩后无言以对!
  13. Hibernate Annotation 生成数据库表(UUId)
  14. Win10下搭建Git服务器
  15. Mysql phpStudy升级Mysql版本,流产了怎么办?
  16. RxSwift学习笔记4:disposeBag/scheduler/AnyObserver/Binder
  17. [BeiJing wc2012]连连看(建模,最小费用最大流)
  18. 利用opencv从USB摄像头获取图片
  19. DXP 内电层分割
  20. DevExpress v17.2新版亮点—WinForms篇(一)

热门文章

  1. du及df命令的使用
  2. 看一段Delphi导出到Word的源代码
  3. iphone数据存储之-- Core Data的使用
  4. Objective-C中.h、.m、.mm的区别
  5. C语言实现链表
  6. Python基础(4) - 变量
  7. Intellij IDEA自定义类模板和方法模板
  8. [转]How can I install the VS2017 version of msbuild on a build server without installing the IDE?
  9. (微信小程序)二 : 创建一个页面。
  10. mongodb操作之mongoose