Original: https://codingcat.dev/post/debug-angular-9-in-chrome-console
These functions are exposed via the global
ng"namespace" variable automatically when you import from@angular/coreand run your application in development mode. These functions are not exposed when the application runs in a production mode.
Chrome Console Utilities
The great part about using the Chrome console is that it gives you access any DOM element that you have selected. For the last item you can get the reference by typing $0 in the console. Below you will see that you can use the selection tool to easily find the element. Once this is selected you can then use $0 as it will be the latest in your selection history. You can read further about this in Console Utilities API Reference.
Getting the Angular Component reference
Now that we know how to get a DOM reference we can use the Angular @angular/core/global utilities, you can find more details here: https://angular.io/api/core/global#entry-point-exports.Using ng.getContext($0) we can access the angular component instance.
// Get this component
let dialogComponent = ng.getContext($0);
// Get parent component
let dialogParentComponent = ng.getOwningComponent($0);
Changing values in the Component
Now that you have a reference to the component using let dialogComponent = ng.getContext($0) we can now update the properties within the component. For this example we will change the qty in our recipeIngredient object.
dialogComponent.data.recipeIngredient.qty = 5;
You should also note that you can display the entire component as well incase you are unaware of the structure.
Making Component Update
In order to get the value change to show within the component you must trigger change detection.
// Apply change detection
ng.applyChanges(dialogComponent);
Resources, Links & Official Documentation
- Angular Developer Guide: Signals, standalone components, and enterprise Angular workflows
Related CodingCat.dev Tutorials & Podcast Episodes
- Adding Angular Components to your static site: Utilizing Web Components within Hugo Static Site Generator (or any static site), to take Stripe/PayPal payments and more!
- Angular and React Bindings for Data Connect in Firebase: Web Architecture & Implementation Guide: Hands-on web engineering breakdown of "Angular and React Bindings for Data Connect" (2025-04-29). Learn how to integrate Firebase, Google Cloud, Web Dev, SQL in...
- Deploy Angular & Next.js apps with App Hosting, now GA! in Firebase: Web Architecture & Implementation Guide: Hands-on web engineering breakdown of "Deploy Angular & Next.js apps with App Hosting, now GA!" (2025-04-09). Learn how to integrate Firebase, Google Cloud, Web...
Frequently Asked Questions (FAQ)
What are the main takeaways from Debug Angular 9 in Chrome Console?
Learn how to inspect and debug Angular 9 components directly inside the Chrome DevTools console using the new ng global object. Debug Angular 9 in Chrome Console explores practical patterns for Angular in modern software engineering. Throughout this post, Alex Patterson breaks down real-world implementation details for Angular so developers can apply these patterns directly in production.
How do you implement Angular best practices in production?
When adopting Angular in a production stack, start by validating your configuration against the Angular Developer Guide (Signals, standalone components, and enterprise Angular workflows). Focus on incremental adoption, automated testing, and observability so your team can measure performance and developer velocity improvements at each stage.
Where can I watch the full Debug Angular 9 in Chrome Console walkthrough and find related code resources?
You can explore the complete write-up and code examples right here on CodingCat.dev, and subscribe to the CodingCat.dev YouTube channel for weekly video tutorials. For a deeper dive into Angular, check out our related guide: Adding Angular Components to your static site.


Top comments (0)