Member-only story
Handling Loading Indicators in Angular Applications the Right Way
An elegant no-hassle way to get rid of meaningless technical plumbing in your business Angular components.

Today's web applications typically solve business problems which can sometimes be very complex and quite hard to write readable code for. Many times, situations arise when a purely technical piece of spaghetti code gets interwoven into a codebase realising a business requirement of some kind. In many cases, such a noise unnecessarily obfuscates the business essence of your components.
Loading indicators are a typical example of such necessary technical plumbing. In most large Angular codebases I have seen, nobody seemed to care about such code polluting business code.
In this article, I will show you an approach I have proposed and successfully implemented at one of my projects which is a rewrite of a huge legacy solution for managing government documents in huge quantities.
🪒 Ockham’s Razor And Its Issues
A typical approach to such a problem is rather naive, utilizing boolean flags in controllers and conditionally showing and hiding a loading spinner, usually looking like this:
export class MyComponent…