Angular is Amazing in 2023!
Angular has recently added an amazing amount of features. It has become a real competition to React again. Signals are absolutely incredible, they are working on new hydration techniques, and the control flow syntax is freaking amazing.
THANK YOU ANGULAR TEAM!
Frankly, you were stagnant for years. It is good to see you are listening to all communities. The work you have done and continue to do is amazing, and the new surprises you gave us (like the new control structure syntax) have been superb.
BUT... and a BIG BUT...
Angular Universal is NOT ready for any real app IMHO.
Angular still does not understand why React has been so great over the years. In my opinion, it is two main reasons:
- Functions (vs Classes) - Creating Functions is extremely easy, and they don't require a lot of overhead. If programmers can use their brains on more important things, they can theoretically have more time to be creative and productive. Unfortunately though, as we know, easier means there is more room for crappy coders as well. Either way, there is another reason people switched away from Classes...
Tree Shaking!!!
Tree Shaking gets rid of dead code. This cannot be done with classes because it is almost impossible for a compiler to know which methods in a class are not being used etc. Nevertheless, in Angular, a good programmer could extrapolate their code in a good way so that Tree Shaking can still happen.
2. NextJS (and Remix) - React meta frameworks have become so popular because they are easy to use on the server! Sure, File Based Routing is easy, but creating endpoints, server only code, mixing code, etc has become the norm.
Angular Universal
So that leaves Angular Universal. What does it need?
Let me ask you a question. Maybe I am ignorant on this fact. How would you connect to a database using Angular Universal? Angular Universal mixes the server code with the client code by if
statements. You simply can't create a REST endpoint without manually hacking the server.ts file. This is not impossible, and works fine, but it is not built into the framework.
What Others are Doing
- Server State Management
- Server Actions
- Streaming (Although I did see this on the Roadmap)
- Server Components (like PHP)
- File Based Routing
- Automatic TransferState
- Resumability
- Hosting Adapters
- Automatic Lazy Loading Techniques
(See my previous post for more on this list)
Analog
I could be wrong, but I think Brandon created AnalogJS to fulfil some of these needs. First it was just an experiment to use Vite, then it became File Based Routing, then SSR, then it was a full Meta Framework!
But... Analog doesn't even use Angular Universal. If Angular can do some of these things out of the box, it could really help the community.
What Angular Universal Really Needs
File-based routing is polarizing, Resumability is for a Qwik only technology, and Server Components are still being adopted. But you know what is a standard and already widely accepted?
- Rest Endpoints - We need the ability to create server side only code to do things like connect to a database. It needs to be built into the framework. It should share state through services to avoid prop drilling, and maybe even through sessions. I don't know what this would look like, but it needs to be the "Angular Way." Right now, you need to use a hack or external framework to do this. This is freakin important.
- Adapters - Google just wants to support Google Cloud it seems. Right now Angular Universal cannot run on any server that does not support Express. This means Deno and Bun are out. More importantly, Edge Computing is out.
Support these Github Issues with Up Votes:
I love what Angular is doing. As soon as ZoneJS is completely optional, I will probably build my next app with it. I'm just not sure Angular Universal is where it needs to be if you want to build a full stack app. Maybe we can get it there! I would like to see Angular's way of server development!
J
Top comments (5)
I don't think so. I think angular screwed up because of endless breaking changes. When you write a larger app, you don't want to rewrite it every couple of years due to changes in the framework. Vue3 also split the ecosystem that way ...now guess what, who stayed consistent and largely backwards compatible ...you get it, it's react. It's not thechnicaly the "best", I personnaly don't even like it that much, but it's consistent. What you wrote years ago still works, and what you do now will still probably work in a few years. That is the real reason of its success IMHO.
There just have not been endless breaking changes. Yes from 1 to 2 obviously, but since version 2 the upgrade path has been fairly smooth. Most Angular 2 code will still run in Angular 17.
Well, I can't actually speak from my own experience, it's also quite old. But as an anecdote, the team leader next to me complained about the breaking changes after each angular 2+ updates. So much that after a few of them, they ditched it in favor of vue2, A few years later vue3 came around, vue2 is deprecated, and the lead became like "oh, whatever, it'll be rewritten in next framework in a couple of years". To date, we still have large codebases of ExtJS, RactiveJs, AngularJs, Angular, Vue2 and recently Vue3 ramping up. All coexisting. It's very cumbersome. Although I don't really like react, and have superficial experience with it, i believe stability is one of its strong point. This is of course anecdotal. Experiences may vary.
You might want to just import the modules you want from these frameworks and use them in Astro. Best of all worlds.
🤣