debugging - how to access Angular2 component specific data in console? -
is there way access angular2 specific component specific data in console, debugging purpose?
like angular1 has capability access components value in console.
update 4.0.0
update rc.1
plunker example in browser console on top-left (filter symbol) select plunkerpreviewtarget
(or launch demo app in own window) enter example
select component in dom node , execute in console
ng.probe($0);
alternative
hint: enabling debug tools overrides ng.probe()
enable debug tools like:
import {enabledebugtools} '@angular/platform-browser'; bootstrap(app, []).then(appref => enabledebugtools(appref))
use above plunker example , in console execute example:
ng.profiler.appref
ng.profiler.appref._rootcomponents[0].instance
ng.profiler.appref._rootcomponents[0].hostview.internalview
ng.profiler.appref._rootcomponents[0].hostview.internalview.viewchildren[0].viewchildren
i haven't found way yet investigate bar
directive.
a better debug experience provided augury builds on api
original (beta)
here summary how https://github.com/angular/angular/blob/master/tools_js.md
enabling debug tools
by default debug tools disabled. can enable debug tools follows:
import {enabledebugtools} 'angular2/platform/browser'; bootstrap(application).then((appref) => { enabledebugtools(appref); });
using debug tools
in browser open developer console (ctrl + shift + j in chrome). top level object called ng , contains more specific tools inside it.
example:
ng.profiler.timechangedetection();
see
Comments
Post a Comment