Welcome to the Angular Tutorial. This Tutorial covers all version of Angular Starting from Angular 2, Angular 4, Angular 5, Angular 6 & Angular 7. We have created a simple and step by step tutorial for beginners to learn the all the features of the Angular. This tutorial is for those who want to learn Angular from scratch.
This Tutorial Applies to: Angular 2 Tutorial, Angular 4 Tutorial, Angular 5 Tutorial, Angular 6 Tutorial & Angular 7 Tutorial.
What is Angular
The Angular is the latest version of the AngularJS, which is a development platform for building mobile and desktop web applications. The Angular now comes with every feature you need to build a complex and sophisticated web or mobile application. It comes with features like component, Directives, Forms, Pipes, HTTP Services, Dependency Injection etc
The Early version of the Angular was named as Angular 2. Then later it was renamed to Just “Angular”. Then Angular Team releases new versions of the Angular versions Regularly and the last Version that is available is Angular 7.0.4.
|Angular 2||14.09.2016||Initial Version of Angular|
|Angular 5||11.11.2017||Version 5|
|Angular 6||03-05-2018||Version 6|
|Angular 7||18-10-2018||Version 7|
|Angular 7.0.4||14-11-2018||Latest Version|
You can read the latest versions at https://github.com/angular/angular/blob/master/CHANGELOG.md
We are going to use Typescript as our language. If you have knowledge of C# or Java, then you would find it very easy. Take a look at the Typescript Tutorial
Introduction to Angular
The Best Books On Angular.
The 8 Best Angular Books, which helps you to get started with Angular.
Architecture and Concepts
It is very important to know how the Angular framework works before you start using it. A Typical Angular Application looks like a Tree of Components. The following Diagram illustrates this Concept.
Installing and Setting up Development Environment
The AngularJs was very easy to set up and get started. That is not the case with the Angular. We need to choose our editor, choose language and find a package manager to load Angular library and all other dependent libraries.
Creating your First Angular Application
This step by step tutorial takes you through the process of creating an Angular application using Angular Command Line Interface (CLI). You can create your Angular project just using a single command. Angular CLI takes care of Configuration & initialization of various libraries.
The Component passes the data to the view using a process called Data Binding. This is done by Binding the DOM Elements to component properties. Binding can be used display component class property values to the user, change element styles, respond to a user event etc.
The Angular directive helps us to manipulate the DOM. You can change the appearance, behaviour or a layout of a DOM element using the Directives. They help you to extend HTML. The Angular directives are classified into three categories based on how they behave. They are Component, Structural and Attribute Directives
The ngFor is an Angular structural directive, which repeats a portion of HTML template once per each item from an iterable list (Collection). The ngSwitch allows us to Add/Remove DOM Element. It is similar to switch statement of C#. The ngIf allows us to Add/Remove DOM Element.
The ngClass Directive is an Angular Attribute Directive, which allows us to add or remove CSS classes to an HTML element. The ngStyle directive allows you to modify the style of an HTML element using the expression. Using the ngStyle you can dynamically change the style of your HTML element.
The Angular pipes are used to Transform the Data. For Example, the Date pipe formats the date according to locale rules. We can pass arguments to pipe and chain pipes. The Angular also allows us to create the Custom Pipe
The Components are useless if they do not share data between them. The Parent Component communicates with the child component using the @Input Annotation. The child components detect changes to these Input properties using OnChanges life Cycle hook or with a Property Setter. The child component can communicate with the parent by raising an event, which the parent can listen.
Component Life Cycle Hook
The life cycle hooks are the methods that angular invokes on directives and components as it creates, changes, and destroys them. Using life-cycle hooks we can fine-tune the behaviour of our components during creation, update, and destruction.
The data entry forms can be a very simple to very complex. The Forms contains large no of input fields, a variety of fields like Text boxes, Dates, Numbers, Emails, Password, Check Boxes, Option boxes etc. These fields can Span multiple tabs or multiple pages. Forms may also contain complex validation logic interdependent on multiple fields.
The Angular forms modules are designed to handle all of the above and lot more. The Angular Forms now supports Model Driven approach to Forms development. The older way of Template based approach is also supported
- Angular Forms Fundamental & Concepts
- Template Driven Forms in Angular
- Validation in Template Driven Forms
- Model Driven Forms in Angular
- Validations in Model Driven Forms
Services & Dependency Injection
Services allow us to create a reusable code and use it every component that needs it. The Services can be injected into components and other services using the dependency injection system. The dependencies are declared in the Module using the Providers metadata. The Angular creates a tree of injector & Providers which resembles the Component Tree. This is called the hierarchical pattern.
- Angular Services
- Angular Dependency injection
- Angular Injector, @Injectible & @Inject
- Angular Providers
- Hierarchical Dependency Injection
The newly designed HttpClient Module allows us to query the Remote API source to get data into our Application. It requires us to Subscribe to the returned response using RxJs observables.
The Router module handles the navigation & Routing in Angular. The Routing allows you to move from one part of the application to another part or one View to another View.
- Routing and Navigation in Angular
- Location Strategies in Angular Router
- Passing Parameters to Route
- Child Routes / Nested Routes
- Passing Optional (Query) Parameters to a route
- Navigation between Routes
- Angular Route Guards
- Introduction to Angular Modules
- Routing Between Angular Modules
- Angular folder structure : Best Practices
Learn how to use Angular CLI to speed up development of Angular Application
The Angular application can use either SystemJs or Webpack module loader. We will demonstrate a how to make use of both the Loader by building a small application.