A Big Yes! It matters a lot because if the code is readable, It will be very easy for the developers to understand the functional flows and the code itself acts as a document, and even it shortens the learning curve and debugging.
Any fool can write code that a…
Consider the code below and let’s see which one gets printed on the console first,
Does setTimeout print the message in the console after a second?
If your answer is Yes, Sorry I couldn’t see the message in the console.
If your answer is No, Is it really a…
Usage: ng.getOwningComponent(document.querySelector(“Your element selector”));
GetOwningComponent returns the parent component of the child component which we queried. If there is no parent component then null will be returned.
Usage: ng.getRootComponents(document.querySelector(“Your element selector”));
This API always returns root components that are bootstrapped by angular.
Usage: ng.getInjector(document.querySelector(“Your element selector”));
This API will return the element injector of the queried element. The returned object contains pretty much information or more like metadata of the element queried.
This element injector encloses the module injector in closure form, so we cannot access the module injector in the…
As we saw in the previous article, there are certain APIs exposed from Angular to debug the application efficiently. Let’s dissect the APIs in detail,
On calling the above method will retrieve the component instance where we can access all the properties and methods related to the component. …
Once the application is staged to silos, source maps would not be available in some cases and this will leads to stepping through unnecessary minified source codes. …
Outlet injectors are the one that injects activated route and children outlet contexts. This injector acts as an intermediary to traverse further up in the element injector hierarchy.
As stated in the previous article,
Whenever resolving a dependency from a hosted component in a router-outlet will first check its element injector, If the dependency is not found then traverse up the element injector hierarchy and once it reaches the OutletInjector It will be further navigated to the element injectors hierarchy that resides outside the router outlet.
If it is not found in the element injectors hierarchy then it will fall back to the module injector hierarchy from the Outlet Injector.
References: Angular source (https://github.com/angular/angular)
Before diving into angular dependency resolution mechanism, let’s have an overview of angular injectors and their hierarchies.
Angular creates hierarchical injectors. These injectors are broadly classified into two types,