Saturday, March 3, 2018

Angular 5 - Complete guide to build SPA (Part 1)

Angular 5 - Introduction

The purpose of this blog is to provide complete details about building an angular app using typescript and Angular CLI. 

Angular CLI is the new command line interface introduced with angular which helps the developer in the development process. It helps to create, build, run and test the required components through CLI commands.  

Why Angular 5?

Many developers who are familiar with previous version of angular like Angular JS, Angular 2/4 would certainly have doubts in their mind about this. Why angular 5?

To answer this, we need to compare each of these and what new changes have been introduced with  new version. There is a major difference in features with angular js and angular versions but angular 2,4 and 5 are almost same with some improvement iterations in the higher versions.

Angular JS vs Angular

Angular is a major update over angular js in terms of syntax as well as functionality.

  1. JavaScript vs TypeScript   -  Angular is written using TypeScript which is the superset of  JavaScript. It takes the advantage that typescript is the only typed language that compiles into javascript. TypeScript makes code easier to read and understand.
  2. Component based Architecture   - Angular application architecture helps to create components that don't depend on each other, which are loosely coupled as possible.
  3. Mobile Oriented Architecture- Angular was designed keeping in mind about the present needs. It designed a framework that can support both mobile app development as wells as web apps. NativeScript helped in angular mobile development faster and effective.
  4. View Engine -  The new view engine introduced helps in generating a smaller code using Ahead of Time (AOT) manner. 
  5. Animation Package - Animation package was removed from the core package in angular. This was because most of the applications doesn't use animations, so this can be removed from core package which will help to reduce the size of the build. This was also done thinking about mobile application development.
  6. Perfomance  - Angular applications are smaller and faster. It consumes less space and run faster which helps in increasing the overall performance of the application.
These differences listed above are with respect to angular js. There are not much difference in Angular 2 , 4 or 5. Its just the performance improvements or the minor functionality improvements. 

Why Angular 4 Not 3?

This would be a question in all developers mind why not 3 after angular 2.

Answer  is simple and it was nothing related to any functionalities introduced, but with the versioning of packages. 

Please refer below image:


When angular 2 was released, the version of angular/router package was already 3. This created some confusion in the developer mind regarding the versions. 

In order to make the versions of the packages same, version 3 was skipped and all the packages were versioned as 4 in the next major release. 

We will be discussing about angular architecture and development environment setup in next blog.


1 comment: