DEV Community

Discussion on: Angular Revisited: Standalone Angular applications, the replacement for NgModules

Collapse
 
fyodorio profile image
Fyodor

One question is interesting to me with this awesome Angular update: are there any significant performance differences between the two approaches? Or it’s only a matter of mental models and levels of abstractions at this stage?

Collapse
 
layzee profile image
Lars Gyrup Brink Nielsen

My guess it's negligible but I imagine there could be a difference in compilation speed between a classic (NgModule-based) Angular application and a standalone Angular application.

The Angular team has suggested that a standalone component introduces a special injector. I'm not sure if or how this will affect runtime performance.

Collapse
 
codecraftjs profile image
Code Craft-Fun with Javascript

With the latest updates ,Angular is trying to achieve more of the functional approach. By introducing the functional based directives , resolvers, guards, it has opened the door for the component to be more independent, segregated. This allows the code to be more flexible. Tree shaking becomes easy as the code is not tightly bound with this approach.

For ex: The injector function eliminates the dependency for the service to be added in the constructor . This make the inheritance easy. A class can be inherited without using the super constructor to be called if the base class is using any service.
Also, the dependency can be lazy loaded based on its usage.

All these powers up the component to stand alone firmly!