History of Angular
- Angular 2: Angular 2 was a complete rewrite of AngularJS. It was first released in May 2016 and the final version was released on September 14, 2016.
- Angular 4: Angular 4 was the updated version of Angular 2. The Google team skipped the Angular 3 to avoid confusion due to the misalignment of the router package’s version which was already distributed as v3.3.0.
- Angular 5: Angular 5 was the improved version of the previous one. It was released on November 1, 2017 and improved the support for progressive web apps.
- Angular 6: Angular 6 Angular 6 was released on May 4, 2018. It was a major released focused on ng update, ng add, Angular Elements, Angular Material + CDK Components, Angular Material Starter Components, CLI Workspaces, Library Support, Tree Shakable Providers, Animations Performance Improvements, and RxJS v6.
- Angular 7: Angular 7 was released on October 18, 2018. It was focused on Application Performance, Angular Material & CDK, Virtual Scrolling, Improved Accessibility, etc.
- Angular 8: Angular 8 is the latest version running nowadays. Angular 8 is released on May 28, 2019. It is mainly focused on Differential loading, Dynamic imports for lazy routes, web workers and Angular Ivy as opt-in support. It also supports TypeScript 3.4.
Setup Development Environment
In this section, we will discuss the Environment Setup.
To install Angular, we require the following tools −
- Angular CLI
- IDE for writing your code
Angular requires NodeJS. It is designed to build scalable applications.
Let’s download and install Node JS from https://nodejs.org/en/download/. Once it is installed, go to the command prompt and check the status by executing this command –
node -v It should return the version you have just installed.
NPM(Node Package Manager):
After installing Node, you need a node package manager for managing the client-side libraries. check if npm is already installed, by running “npm -v” command. If it returns the version of npm, then you don’t need to install npm. Else, you need to install npm and for that, you can run the npm install npm@latest -g command.
In actual development, you will typically use the CLI, a powerful command-line tool that lets you generate and modify applications.
Step 1 — Let’s start with the first step, where we’ll install the latest version of CLI
Angular CLI is the official tool for initializing and working with Angular projects. Head to a new terminal and execute the following command:
npm install -g @angular/cli
CLI is installed on your system.
Go to your terminal and execute these commands:
ng new ngdemo
The CLI will prompt you and ask whether you would like to add routing. Say Yes. It’ll then ask which stylesheet format you would like to use. Choose CSS.
CLI will generate the required files and folders, install the packages from npm, and even automatically set up routing in our project.
Now, go to your project’s root folder and run the local development server using these commands:
Open a web browser and go to the http://localhost:4200/ address. You should see the starting page.
IDE for writing your code:
You can use any IDE of your choice, i.e., WebStorm, Atom, Visual Studio Code, etc. I prefer Visual Studio Code over other editing tools because it is free and lightweight and many extensions are available to speed-up the development. So, let’s download and install the latest version of the Visual Studio Code from here.
Is using Angular Beneficial?
Companies today are targeting applications for the “mobile-first” world that work across platforms. It is the central approach for the development project of any web or mobile apps while reaching out to target customers. This shift has indeed translated in the change of strategy for front–end development. In line with this, there exist many platforms for web development today. The plan is to pick the right one.
Features Of Angular:
- Two-way data binding: AngularJS uses two-way data binding: any changes in the user interface immediately influence application objects and vice versa. When the framework encounters browser events, module changes and user actions on the page, it outright updates the necessary patterns. At the same time, there’s no need to store links to DOM elements and directly manipulate them. We simply describe the result with model state terms and don’t need to use low-level constructions.
- Improved server performance: Because it supports caching and many other processes, Angular reduces the burden from server CPUs. It means that the server performs extremely well thanks to reduced traffic and because it only serves static files and responds to the API calls.
- Faster application prototyping: Rapid prototyping is indeed a buzzword thanks to the existence of frameworks. In no time and by writing significantly less code, you can develop app prototypes with good functionality, obtain feedback and make changes without getting annoyed.
- Responsive web: There’s nothing better than arranging an outstanding end-user experience and AngularJS makes it possible by letting responsive, fast-loading and seamlessly navigating websites and apps.
- Highly testable products: One of the underlying aspects of Angular is that it builds highly testable websites and applications. By allowing unit testing and end-to-end testing, it makes testing and debugging much simpler than you can imagine. Dependency injections, for example, allow various components to be isolated and mocked. Protractor, Jasmine, and Karma are other unique testing tools that the framework offers.
- The MVC architecture: AngularJS makes use of MVC architecture to develop robust and interactive developing web applications. For Implementation of MVC, all you are required to do is split your application and rest everything will be get it done by AngularJS.
- Using directives: As its pattern language, Angularjs uses HTML. It is expanded with directives (for example, ) that add to the code information about the necessary behavior. Directives make you focus on creating logic and thus allow you to work more productively. You can reuse them to improve code readability.
< appHighlight > < / appHighlight >
custom class names
< div class=” appHighlight ” >< /div >
or custom element attributes
< div appHighlight >< /div >
- The Plain HTML templates: That AngularJS uses plain HTML templates is another amazing aspect. Going further, the templates are passed to the compiler as DOM elements and not as strings and this particular advantage ensures better workflow. Moreover, it allows for easy manipulation, extension, and reusability of templates.
- Fast development: If you are a fast learner, you can get familiar with AngularJS in no time. And once you feel fully comfortable working with it, you will see that your development efforts and time spent dealing with it will shrink.
- Reusability. Developers can reuse them across different parts of an application.
- TypeScript. better tooling, cleaner code, higher scalability.
- The platform-agnostic philosophy. Angular was developed with the mobile-first approach in mind. The idea is to share the codebase and ultimately the engineering skillset across the web, iOS, and Android applications.
- Universal. It is a service that allows for rendering applications view on a server instead of client browsers.
- Google Long-Term Support. Google has provided long term support. So it has more collaborators.
Which projects should Angular be used in?
If you find yourself amidst a complex web project that requires business-logic at the front-end, lots of asynchronous network calls, and a seamless look and feel concerning user experience.
Let’s see some specific examples:
- Enterprise web apps. Angular has all the features needed to develop large-scale projects, as the team claims it.
- Apps with dynamic content. Angular is a perfect technology for websites where the content should change dynamically based on user behavior and preferences. Dependency injections ensure that in case one component is changed, other components related to it will be changed automatically.
- Progressive web apps. Angular is equipped with built-in PWA support.