Issue
I would like to know when should I use Standalone components and when should I create a new module. Since it's a new concept introduced in Angular, what are the criteria to use them?
I've created a new whole app only using standalone components with lazy loading routes, and everything works perfectly. Here the repo: https://github.com/Ismaestro/angular-example-app
So this means NgModules are obsolete?
What are the advantages and disadvantages of each of them?
Thanks in advance.
Solution
Standalone components are not mandatory and will never be, there is no rule when to use them. However, Angular Architects recommend to always use Standalone components at least for new components you create. They are simply more treeshakeable and less boiler. You can mix standalone components and modules also.
For the mentioned recommendation of the Angular Architects, you can also watch the Webinar from last Monday: https://www.youtube.com/watch?v=9rj8kR0q0c8
Answered By - MoxxiManagarm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.