Over the past month and a half I've been working on a single-page app with Angular. When I heard that we had to use Angular I squirmed and thought to myself 'Why? There are so many better options out there'. I like many others out there have heard stories about how Angular was completely re-written for version 2 and ruined it's reputation. I've heard that the framework is bloated, complicated and overall too large for most projects.
I'm here to share my experience of being a primarily React developer, shipping React code in production to using Angular for a production application.
This wasn't my first rodeo with the framework. For my diploma I made the same app with React, Vue and Angular in an attempt to try and compare the 3 and see if one is better than the other (all 3 are great, all 3 have flaws, there is no 'best option'). I wasn't completely unfamiliar with Angular when I started working at this current company, but I was more inclined to using React because I was just more comfortable with it.
Before starting work on the new project I had a 3 days weekend and so having a more open mind I went through the Angular tutorial once again, skimming the TypeScript quick start and occasionally looking at the RxJS documentation before I started working on the project the next week.
Angular has a LOT of files per component. 3 at the least, one being the
.html or template, then the
.ts file for logic and a
.css or more likely
.sass file for styles. This was hell for a while untill I got used to it. Coming from React where everything is shifting to a single file component with JSX and CSS in JS, this was frustrating for the most part.
At the same time however I understand that 'separation of concerns' is a good architecture choice so I have nothing to complain about. The problem does become apparent however when you have a lot of components to work on and passing data between them can get a little messy. Still, nothing someone can't get used to and understand why it's important.
TS in Angular is not the same as TS in any other framework. It's used heavily and in way I still don't quite understand. But at the same time it was a great learning experience, because I can now write TS with no issue on any other project, which was one of my learning goals for 2020 anyway. Also you get to use it as much as you want, it's more of another 'testing' and 'linting' layer to help developers write safer and cleaner code. Throw in TSLint and the code base looks the same for all developers.
I read somewhere that this was the most confusing and hard part of working with Angular. I maybe haven't delve deep enough into observables to actually encounter a specific thing that I find confusing because working with RxJS, the operators, subscriptions was not at all hard or confusing.
You just subscribe to an observable like a http GET request and once the server returns data you resolve it just like you would by using a
then on a promise. It also provides a great deal of
operators to help you manipulate and edit observables without much hassle.
RxJS gets a plus from me. No complaints so far, but I don't really see why I would use observables outside of Angular.
Angular isn't just a view layer where the developer can use whatever packages and modules they desire, instead it's a bit opinionated and comes with a variety of different funcionalities from routing, forms, http requests, the before mentioned RxJS and TypeScript.
And this isn't a bad thing. It's a choice. Do you want to use React where you have a choice of what to use so you can be flexible and develop apps the way YOU want them to, but at the same time risking shooting yourself in the foot because you didn't account for something. The reverse goes for Angular. You have a complete package of tools that allows you to build a complete app without having to implement or think about outside solutions, but you give up some of that freedom you might have with React, which in my opinion is understandable.
This is why Angular is still more popular than React in enterprise solutions, but less so in smaller communities where people want flexibility.
Don't limit yourself to technologies just because they aren't as popular or because you think those technologies are doing something bad, instead try them out and form your own opinions on the ecosystem and developer experience by making some small apps. Same goes for languages and other things in the technology world.
Thank you for reading.