I am sure no one told you these Angular debug tips (Part 1)😱

ng.getComponent

var titleHeader= document.querySelector(‘#title-header’);var appComp = ng.getComponent(titleHeader);
ng.getComponent($0)
ng.getComponent($0).title= "Welcome debugger";

ng.applyChanges

ng.applyChanges(appComp);
ng.applyChanges($0)

ng.getInjector

ng.getInjector(appComp);
ng.getInjector($0);

ng.getOwningComponent

var titleHeader= document.querySelector(‘#title-header’);var appComp = ng.getComponent(titleHeader); ng.getOwningComponent(appComp); //Or var titleHeader = document.querySelector(‘#title-header’); ng.getOwningComponent(titleHeader);

ng.getContext

// get the AppComponent var appComp = ng.getContext($0) // get the AppComponentvar subComponent = ng.getOwningComponent(appComp)// Change the title nameappComp.editingTitle.name = 'Welcome Debug';// Compare the hero in the child an parent component appComp.editingTitle.name === subComponent.variable[4].name;// Save the changes to the hero appComp.saveTitle()// Apply change detection ng.applyChanges(appCOmp)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store