Angular 2 is Google’s powerful TypeScript-based framework designed to build applications and websites. It allows developers to create highly-functional cross-platform apps. Angular 2 is not an upgrade to AngularJS—it’s been completely rewritten and both versions are still officially supported. I wanted to throw in a few words about both of the frameworks based on my experience in working with the two of them.
AngularJS—An Overview
After AngularJS was released, only lazy didn’t want to write their own TODO List in it. It was way faster than jQuery, and it was something fresh. But my experience with AngularJS (the first major version of Angular) turned up mixed feelings. On the one hand, it was a new thing in front-end developing, allowing users to do the same things faster, but on the other, I had a looming feeling that something was wrong with the framework.
After using it for a while, I knew what it was. AngularJS gives you a framework where you still need to write a lot of JavaScript code describing functionality, without actually making it work.
Angular 2—Something New?
Considering my lukewarm experiences with AngularJS, I asked myself if I should even start with Angular 2. In the front-end developing world, there are already so many frameworks, a lot of them good ones. If so, why should I use Angular 2?
When a new framework is developed, it’s always described as faster than others, with a lot of innovative changes implemented to improve the performance, the flow of work, etc. It was the same story with Angular 2. But what convinced me to try it was that the same team of devs responsible for making AngularJS created Angular 2. They were familiar with the first Angular, so they knew the pros and cons of the framework. They knew what worked and what did not. It’s like that with every software—you write a program, and after a while, you begin to see what you could have written in a better or different way. You are equipped with the necessary experience to make something more efficient.
But it took the team a long time to develop the new framework. Angular 2 was announced in September 2014, with the first beta being available no sooner than December 2015, and the candidate for the final release in May 2016. However, a fully-working version wasn’t available to users until September 2016. So it took the team two years to create the final release of the framework. This is way too long for the front-end world where new frameworks are released every few days. Regardless, the team has done a great job. Again, they did something new and fresh.
My Experience with Angular 2
When I sat down to writing an application in Angular 2, the familiar TypeScript welcomed me. It wasn’t a new version of the language but it was structured differently. And actually, after years of coding in the back-end, it was the first time I saw a good structure of JavaScript application where, instead of writing the description, I only needed to implement logic.
I wrote my first component, and surprise. Too much code: a lot of HTML, a lot of TypeScript. I resolved to the documentation provided with the framework and found out that without it, it would be virtually impossible to write with strict types. So after half an hour of reading, I wrote my first service, followed it by a reusable component, then a pipe, and…
…I had my first working application in Angular 2. It wasn’t anything special, definitely not a business application, just a test website app to see how Angular 2 works. And it did work just fine.
Encouraged by the results, I decided to write a mobile application with Angular 2 and Ionic 2. I started out by writing the same simple code, adding the same simple methods as in my basic web application. In 30 minutes, and after reading about Ionic 2 for an hour, I had a working mobile application on my smartphone. It was the same app I wrote previously only this one designed for a smartphone. That cross-platform capability of Angular 2 explains the caption on Angular 2 website, “One Framework. Mobile and Desktop.”
The Problem with AngularJS
After my encounter with Angular 2, I already knew what was wrong was AngularJS. To me, it was the two-way data binding performance. How did it influence my work? Well, I wrote the same functionality (or almost the same) in AngularJS and Angular 2 for few hundred models. Then I started changing some of the models’ properties, and… that’s what I call a thorough test! Try doing something similar and you’ll quickly see the difference between the two frameworks.
On the web, you can find a lot of articles advising for or against using Angular 2. The only advice I have for you is, instead of wading in this analytical paralysis, try for yourself and use the two frameworks. But don’t just write a sample app, for it won’t give you a finite conclusion. Spend more than a few hours on writing an application. The verdict will come soon enough, revealing what I have discovered in Angular 2—something fresh and new.
NOTE: The newest version of Angular, Angular 4, was released at the end of March 2017. It packs new features and has better performance, but don’t worry and go ahead: Angular 4 is a new version of Angular 2, not new Angular.
On-demand webinar: Moving Forward From Legacy Systems
We’ll walk you through how to think about an upgrade, refactor, or migration project to your codebase. By the end of this webinar, you’ll have a step-by-step plan to move away from the legacy system.
Latest blog posts
Ready to talk about your project?
Tell us more
Fill out a quick form describing your needs. You can always add details later on and we’ll reply within a day!
Strategic Planning
We go through recommended tools, technologies and frameworks that best fit the challenges you face.
Workshop Kickoff
Once we arrange the formalities, you can meet your Polcode team members and we’ll begin developing your next project.