Wed Oct 21 2015
Paul Shan
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.
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.
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.
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.
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.
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.
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
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.
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.
As Angular 2.0 templates are using ES6 module spec, so template compiling will be asynchronous from now on.
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.
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.
No, you can use vanilla JavaScript too as I mentioned in the last point. Dirt is another option for you.
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.
No $scope and jqLite; that’s for sure.
“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
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.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