Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A very usefull hint I got from a MV AngularJS meetup few months ago:

  if you select an element in DOM inspector in Chrome, 
  its scope will be accessible via $scope in the console
Another trick that I use daily: to get a reference to some service(or anything injectable for that matter) from the console:

  angular.element(document).injector().get('myService')


The first trick requires having the Angular Batarang installed, right? Still cool, I didn't know about that. I've been manually typing angular.element($0).scope() like a sucker.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: