AngularJS debug tips
1 min readApr 24, 2015
在 chrome inspector 可以抓到一些 AngularJS 的資訊, 方便 debug
- Scope
angular.element($0).scope()targetNode 可以塞入想觀察的 DOM element。chrome inspector 有 default 的 $0 ~ $4 可以用。但其實裝 ng-inspector 就可以看到所有 scope 了。
- Service
angular.element($('html')).injector().get('$location')Get kcliu’s stories in your inbox
Join Medium for free to get updates from this writer.
可以完整抓到 $location,同理如果有改值,還可以 call $apply() refresh
angular.element($('html')).scope().$apply()refs:








