I'm learning Angular and I made a simple game, I'm using ng-inspector to view current variable value, but how can I cahange variable value with browser console?
You may access a controller's scope in the console by:
var scope = angular.element($0).scope();
$0
is a reference to the selected DOM element in the console (webkit).
If instead you want access to factory/service variables you may use the injector method:
var injector = angular.element($0).injector();
var srv = injector.get('serviceName');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With