Angular 8 Tutorial

Angular 8 Introduction History and versions of Angular 8 Architecture of Angular 8 How to install Angular 8 and set-up it. Creating our first Angular 8 app Angular 8 app loading

Difference between Angular And react

Angular vs react

Angular 8 Advantages Disadvantage

Advantage and Disadvantage of Angular 8

Angular 8 file structure

Angular 8 file structure

Angular 8 components

Components of Angular 8

Angular 8 CLI Commands

All CLI commands of Angular

Angular 8 with Bootstrap

How to install bootstrap for Angular 8 Libraries of Angular 8

Angular 8 Routing

Routing in Angular 8

Angular 8 directives

Angular 8 Directives Angular 8 ngIf directive Angular 8 ngFor directive Angular 8 ngSwitch directive Angular 8 ngClass directive Angular 8 ngStyle directive

Angular 8 pipes

Angular 8 Pipes

Angular 8 databinding

Angular 8 Data binding Angular 8 Event binding Angular 8 Property binding Two-way data binding in Angular 8

String Interpolation In Angular 8

Angular 8 String interpolation

Angular 8 forms

Angular 8 Forms Data flow of forms in Angular 8 Creating forms in Angular 8 Testing and validation of forms in Angular 8

Error fixing in Angular 8

Error fixing in Angular 8

Dependency injection and services in Angular 8

Dependency injection services in Angular 8

Angular 8 Animations

Angular 8 Animations

Dynamic components in Angular 8

Dynamic components in Angular 8

Angular 8 Module

Angular 8 Module Deploying an angular 8 app

Introduction of unit testing in angular 8

Unit testing in angular 8

Observables in angular 8

Observables in angular 8

Angular 8 universal

Angular 8 universal

Angular 8 Changes and new features

New features and changes in Angular 8


Angular 8 Conclusion

Data Binding in Angular 8

What is Binding?

Binding is the process which generates the connection between the application UI and the data which comes from the business logic. In Angular, it is called the automatic synchronization of the data and the view.

Data Binding in Angular 8

Data binding is the most important and essential features in any software development language. It is a powerful feature of Angular. Angular Data binding is used for communication. It allows us to define the connection between the component and view. So, we can say that data binding is passed from component to view. It makes it easy to identify interactive applications without worrying about pushing and pulling the data. It is mainly used to communicate between our Typescript code and another component.

It has mainly two parts:

HTML Template

It contains view for the component (HTML elements: input, select, button, etc.)

Component Class

It contains logic for a component like classes, variables, functions, API calls, etc. The interaction between the HTML template and component class can be done through data binding.

In simple words,Data Binding is communication between typescript code of our component and our template which user sees.”

 Data binding can be one-way data binding or two-way data binding.

Data binding in Angular 8

One way data-binding:

It is a simple one-way communication where HTML template is changed when we make changes in typescript code. The value of the model is used in the view (HTML page), but we can't update the model from the view in one-way data binding.  Property binding,  Event binding, and String interpolation are an example of one-way data binding.

one way Data Binding in Angular 8

Two-way data binding

In two-way data binding, automatic synchronization of data happens between the model and the view. Here, changes are reflected in both components. When we make changes in the model from the view, and when we make changes in view, it will be reflected in the model.

This will happens immediately and automatically, ensures that the HTML template and the Typescript code are updated at all times.

two way Data Binding in Angular 8

Types of Data Binding:

  • String Interpolation
  • Property binding
  • Event Binding
  • Two Way Data Binding
Types of Data Binding in Angular 8
Component of Data Binding

String Interpolation

String Interpolation is a one-way data-binding technique which is used to output the data from a TypeScript code to HTML template (view).

It uses the template impression in double curly braces to show the data from the component to the view.

For example:


String interpolation sums the value of a property from the component.


  • Name: {{}}
  • Email: {{user. Email}}
  • Property Binding

    Property binding is a technique, which will help to bind values to the properties of HTML elememts. It is also a one-way data binding approach.

    In property binding, we bind a characteristic of a DOM element in a field which defined property in our component Typescript code.

    Property binding helps us to bind the values to the target property of the element property surrounded within the square brackets.

    For example:


    Event binding

    Event binding is used to hold the events lifted from the DOM such as button click, mouse move, etc. in Angular 8. When the DOM event happens (e.g., Click, change, key up), it calls the specified method in the component. In the following example, the cookbacon() method in the component is called when the button is clicked:

    For example:

    <button (click)=”cookBacon()”>

    Two-way Data Binding

    In one-way data binding, any changing in the template (view) was not considered in the component Typescript code. To solve this problem, Angular produces two-way data binding.

    The two-way binding has a vital feature to update data from component to view and view to the element.

    In two way data binding, property binding and event binding are combined. For two-way data binding, we have to enable the ngModel directive.


    [(ngModel)]=”[property of our component]”
    Two-way Data Binding