What's new in Angular 2.0? Why it's rewritten - addressing few confusions

Wed Oct 21 2015

Paul Shan

What’s new in Angular 2.0? Why it’s rewritten - addressing few confusions

First official announcement of Angular 2.0 was made at the ng-conference in October, 2014. There the team Angular said, they are not going to release a new major update of AngularJs, but an entirely rewritten framework with no backward compatibility.

This step is taken not only to improve the current angular in terms of features and performance, but also because they are more interested in future web; i.e. web components and ES6; which is a phenomenal thing about this beautiful framework.

This article is devided into two sections. One contains the specialities of AngularJs 2.0; whereas in the second part I tried to answer few very common questions related to the new framework.

What’s new in AngularJs 2.0

Though Angular 2.0 is enriched with hell lot of features, but here I will describe only those which is really extraordinary and forced the team to rewrite the framework.

Change in ideology

When Angular was first created, the major focus was on data binding, templating etc. The primary target was to get rid of the traditional painful process of handling DOM using JavaScript / jQuery. But now the world has been changed, JavaScript has been evolved, definition of client side app has been modified. Thus there was a requirement for a complete different framework.

A future ready framework

Angular 2.0 syntaxes are not very much vanilla JavaScript; I mean it’s preferred to use AtScript or TypeScript which is based on ES6. As we all know browsers have already started implementing ES6 and soon we all will start developing our apps in ES6 instead of ES5. Angular 2.0 is giving this opportunity to you, with 100% browser backward compatibility.

Web components

Another futuristic thing is Web Components. Web component means small or integrated modules of HTML and JavaScript (css can also be added) which is made to look after a specific work. Many believes in future the web development will be based on web components only (frameworks like polymer are running on this path). Angular 2.0 is providing you a platform for web component based development.

Router changes

As things have been moved to MVC to web components, routers are also redesigned. The child router will convert each component of the application into a smaller application by providing it with its own router. It will help encapsulate entire feature sets of an application.

No require.js (in future)

Previously in case of large Angular apps, for modular code structure I had to use require.js; but as Angular 2.0 by default supports ES6, things are auto modular. No need for a third party library. However currently as browsers are not supporting ES6 properly, you will need system.js

Much better DI

The DI in Angular has been improved a lot in 2.0, where they introduced child injectors, instance scope etc. More on this can be found in the upcoming tutorials of Void Canvas.

Dynamic loading

Many of us may have faced the necessity where you wanted to provide the controller or directive at runtime. Don’t worry, you are all set to fall in love with 2.0.

Async templating

As Angular 2.0 templates are using ES6 module spec, so template compiling will be asynchronous from now on.

Logging

A service called diary.js has been introduced to Angular 2.0, which will help you to log the application’s performance. This can be very useful to find the flaws of your own code and make the app more performant.


Confusions regarding AngularJs 2.0

Can I use ES5?

Yes you can. But things will be more ugly I guess. Moreover Angular 2.0 is future, so it’s better to use ES6 like syntaxes through typescript.

Is TypeScript mandatory?

No, you can use vanilla JavaScript too as I mentioned in the last point. Dirt is another option for you.

Is there no controller?

If we look at a lot of different apps today we would probably see the same thing as the Angular team has seen in the 1600+ projects used internally at Google: controllers aren’t really needed. But yeah, directives still have the controllers.

Is $scope and jqLite really removed?

No $scope and jqLite; that’s for sure.

How to upgrade my app to 2.0?

“It’s really hard for us to build a bridge to a city that doesn’t exist yet.” – Brad Green, Engineering Director, Angular core team. Right now there is no specific way, but we can see ofter angular 2 is fully created.

SHARE THIS ARTICLE

post-thumbnail
Today everyone knows the importance of a lightning-fast website and how the speed impacts the conversion rate of a business. Today, everyone wants the site to be a PWA so that the mobile users can have an app-like experience with the website because, for the majority of the merchants, the customers come through mobile devices.
Tue Apr 20 2021
post-thumbnail
Here we are going to see how you can manage backup and restore of Postgres database with docker.
Thu Sep 03 2020
post-thumbnail
Image sliders or carousels always have increased the UI attraction of websites and they are pretty useful for reflecting the major roles/products too. In case, I am having a website that sells tee-shirts,
Mon Apr 30 2018

About VoidCanvas

This blog was created out of hobby and talks mostly about technology, web development, JavaScript, NodeJS and related topics. Thank you for reading my blog.

Copyright 2022 - www.voidcanvas.com

Popular Articles

Authentication using Google's oAuth api with node.js

Thu Mar 10 2016

OAuth authentications are pretty popular now a days and another thing which is popular is JavaScript. This article shows how to plugin google’s oAuth api for authentication in your own node application.

CSS3 Loader Snippet Collection: (Part 2 - Squares)

Sat Mar 01 2014

This is a continuation of my CSS3 loader snippet collection series. I've provided spinning css3 animation loader in the part 1 of this series and here in part 2, I'm providing various square type loading