Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

What’s New in Angular 2

Friday, July 1st, 2016 by Servage

angular2Angular 2 has been in a publicly available beta since December 2015. Angular is considered rather difficult to learn compared to alternatives such as React. Angular 2 makes it even more confusing with big changes to the framework. To clear out this confusion, this article explains the most significant changes made in version 2.

Leaving controllers and directives behind

One of the biggest changes in Angular 2 is a component-based way of building user interfaces. In Angular 1, user interfaces were built using controllers that were attached to HTML elements using directives, more specifically the ng-controller directive. This is not the case in Angular 2 where these two features are replaced with components.

Introducing components

A component does what a controller used to do in version 1. It provides a certain functionality for the HTML element it has been attached to. A component can be attached to an element using selectors. A selector is similar to the ng-controller directive: you give it an HTML tag and the component automatically attaches to the given tag. For example, a selector of “my-app” attaches to the HTML tag. Because components are tied to HTML tags this way, old Angular directives are no longer used in Angular 2.

By introducing components, Angular is moving towards a more React-like development pattern. React is considered the biggest competitor to Angular and it has been growing in popularity tremendously since it was released in 2013. React is said to be easier to learn for new developers compared to Angular. Perhaps this change will make Angular more interesting to new developers who are seeking more experience in front-end JavaScript frameworks.

From JavaScript to TypeScript

Yet another big change to the framework is that Angular 2 has been rewritten with support for TypeScript, a superset of JavaScript with a goal to make writing JavaScript easier by adding new features to the language. TypeScript adds object-oriented programming, lambdas and much more to traditional JavaScript and it is fully compatible with JavaScript, meaning all JavaScript code is valid TypeScript. However, it is possible to keep developing Angular applications using plain JavaScript.

Other changes

These three changes are arguably the biggest changes in Angular 2. Other smaller changes include reduced browser compatibility due to these new features, lack of the $scope variable because it is now part of components, and improved routing. Angular 2 drops support from old Internet Explorer versions and now supports only IE11 and auto-updating browsers such as Firefox and Google Chrome. Last but not least, Angular 2 attempts to gain more popularity as a mobile framework by increasing the performance of touch animations.

What’s New in Angular 2, 5.0 out of 5 based on 3 ratings
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet (leave a comment)

You are welcome to initiate a conversation about this blog entry.

Leave a comment

You must be logged in to post a comment.