Angular event
- Angular 事件系統不與瀏覽器事件系統相通,只能在作用域上監聽Angular事件而不是DOM事件
- 傳播
- 向下傳遞:$emit()
- 向上派送:$broadcast()
- 兩種方法都接受name(事件的名稱)和args(參數的集合)兩個參數,並都返回一個事件對象
- 監聽:$on()方法
- 事件對象屬性
- targetScope(作用域對象)
- currentScope(作用域對象)
- name(字符串)
- stopPropagation(函數)
- preventDefault(函數)
- defaultPrevent(布爾值)
- $emitted事件
- $includeContentLoaded(ngInclude指令上觸發)
- $includeContentRequested(ngInclude作用域上發送)
- $viewContentLoaded(ngView作用域上發送)
- $broadcast事件
- $locationChangeStart
- $locationChangeSuccess
- $routeChangeStart
- $routeChangeSuccess
- $routeChangeError
- $routeUpdate
- $destroy