History of SPA frameworks: AngularJS 1.x and nostalgia.

‘Member that time? Ooh, I ‘member. (South Park: Member berries.)

This happened a long time ago, almost 5 years ago…

Almost every developer knows that AngularJS was one of the first JavaScript frameworks for building Single-page applications. Nowadays, we aren’t amazed of SPAs, they are everywhere. But 5 years ago (since AngularJS 1.0.0), it was a something new.

I switched to Angular at 1.2 version, so please, Angular-experts, correct me if I am wrong. In text below: Angular === AngularJS 1.x.
Also, should we talk about AngularJS in the past?

Why we still like Angular 1.x? Do you remember?

AngularJS was easy to start.

Yes, it was very easy to start a new project. Just insert links to CDN, add ng-app to <html>, quickly read easy tutorial — and your new Angular app (tutorial app) is waiting for you. Official modules like ngAnimate and ngRouter quickly solved all your problems.

AngularJS Docs and Tutorial.

AngularJS had a very good documentation and the tutorial was amazing. After Phonecat App” tutorial you perfectly understood what exactly was AngularJS and how to use it. And it was clearer than any “Tour of Heroes”. (Yes, Angular 2, I’m talking to you).

Angular was modular, even in the 1.x version.

Do you remember that time, when we used Browserify and Bower?

We didn’t have tools like Webpack for bundling. Yes, Grunt and Gulp existed at that time, but they’ve been used things like gulp-browserify. So, formally we used Browserify.

Oh, do you remember that time, when we used Bower?

But Angular’s ng.module was a very cool feature. You can just insert links to your scripts and they will be interpreted as modules of one application. It was very useful and innovative — Angular’s module system. As opposite to jQuery’s $.fn.myNewAwesomePluginForJQueryThatNobodyDownloads AngularJS provides you to write your own modules and use them as plugins or parts of your app. Also, it was very useful for lazy-loading.

Think Angular, not jQuery.

I still remember that time when almost in every article I found this phrase. Many developers switched to Angular from jQuery and “Thinking Angular” was a problem. I don’t want to remember that jQuery-time, when every project’s dependency was jQuery and first association with spaghetti was your code, but not your dinner.

jQuery vs AngularJS vs Angular — Google Trends. http://bit.ly/2pc1mK7

Two-way data-binding — was a “killer feature” or just a “killer”?

Stuff like ng-model — directive that connects your object from $scope to DOM element — was a killer feature and a killer at the same time:

  1. You can implement two-way data-binding easily — Killer feature.
  2. Developers with small experience in Angular bound every variable to controller’s $scope and after that asked: “Why my app is so slow?” — Killer.

One-way data-binding was introduced in the 1.2 version, but I’m sure not all developers knew about it.

jqLite — mini-jQuery inside your framework.

jqLite is a tiny, API-compatible subset of jQuery that allows AngularJS to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most commonly needed functionality with the goal of having a very small footprint.Directives and component-based paradigm.

So, you don’t need to include full jQuery build. Think Angular! jqLite provides all that you need. But, wait… Do you really need it?

Separating DOM manipulations into a small library that can be accessed only through angular.element. Was it a step to the new level of abstraction? Maybe.

First component-based paradigm.

First attempt to implement component-based paradigm was in Angular. But as opposite to React, Angular was “JS in HTML”, not “HTML in JS”. Even Angular’s title declares it:

“AngularJS — HTML enhanced for web apps!”

Why “JS in HTML”? Because of directives like ng-click, ng-for and ng-class in your application’s .html files.

Directives were the first attempt to separate commonly used components in small modules. And it fails, because of React-like components implemented in Angular 1.5. Maybe, React won because one day your file-name.html could became:

A bad code that shows the biggest problem with Angular.

All you need is… Angular’s core.

Built-in directives

There is no need to reinvent the wheel when you already have all directives what you need. From my own experience, some developers didn’t create directives at all. They just used built-in directives of Angular, like mentioned above ng-click and ng-for. I even know some projects that were written without any custom directives. Note: it’s not a good practice.

Dependency Injection in JavaScript.

One very interesting thing in AngularJS —it’s dependency injection. Have you ever seen it elsewhere in JS before AngularJS? Personally, I haven’t.

Uncovered topics. Angular is huge.

There isn’t any sense to consider every Angular topic:

  1. Services, factories, providers in AngularJS.
  2. “How to minify Angular app?”
  3. “How $scope.$watch works?”
  4. “How Angular works at all?”
  5. Built-in $http, ordering, filters and ng-for performance.
  6. What was the biggest problem with Angular?

VeryLongList

It’s so big that you can conduct an academic study about Angular.

So why we switched from AngularJS?

  1. Not so good performance out-of-box.
  2. Some AngularJS features you could never use at all, a lot of code was unused. Lite version of Angular solved it.
  3. AngularJS relied on browser DOM, not on VirtualDOM.
  4. Low-level of abstraction, AngularJS relied on HTML markup.
  5. It’s hard to be an expert in AngularJS, Angular is huge.
  6. Finally — modern Web requires new Thinking.

What AngularJS made for the Web?

It’s simple and complicated question at the same time.

#8 in Github’s rating by “most starred”.

JS === Power

Maybe, Angular was the first tool that proofs: JavaScript is powerful. Commonly shared myths like “JavaScript is a language for kids” or “JS is a language for making stupid animation” were destroyed with a help from Angular too.

Community, experts, ecosystem

Good framework => More developers.
More developers => Bigger community.
Bigger community => More components, tools, tutorials.
More tools and practice => More experts.
More experts => More new ideas, frameworks. 
Pure Progress.

Vue, Aurelia, Angular 2/3/4

All these frameworks were inspired by AngularJS. Aurelia is a fork of Angular. Angular 2+ is a “continuation” of AngularJS. Some developers call Vue as a new AngularJS because of v-if, v-bind, v-on and other directives.

Do you remember that time?

SPAs is a real-life routine, that we build, design and use every day, but let’s imagine how cool it was 4 or even 5 years ago. But new Web === new Challenge.

So, do you still remember how to “Think Angular”?

Also, did you remember that we consider the 1.x version?