Table of Contents

Angular Docs Getting Started

What is Angular?

https://angular.io/guide/what-is-angular#what-is-angular

Angular is a development platform based on TypeScript. It includes:

Angular applications: The essentials

Components

A Component includes a TypeScript class with:

Templates

The HTML template declares how the component should be rendered. It can be done inline or by file path.

Inline:

@Component ({
  selector: 'hello-world',
  template: `<p>{{message}}</p>`
})

By file path:

@Component ({
  selector: 'hello-world',
  templateUrl: './hello-world-interpolation.component.html'
})

The following examples illustrates how the HTML attribute style.color can be bound to the TypeScript variable fontColor from the component class.

<p
  [id]="sayHelloId"
  [style.color]="fontColor">
  You can set my color in the component!
</p>

Event listeners can be declared with the help of parentheses:

<button
  type="button"
  [disabled]="!canClick"
  (click)="sayMessage()">
  Trigger alert message
</button>

The event listener calls the method sayMessage() which is defined in the component class.

Directives can be used to add features to the templates. For example:

It is also possible to declare own custom directives.

Dependency Injection

Angular CLI

First-party libraries

Try it

Setup

…