Angular 8

Angular 8, Why compile with AOT? When?

What Is the Angular Compiler? Explore…
Why compile with AOT? When?
1.      Faster rendering
2.      Fewer asynchronous requests
3.      Smaller Angular framework downloads size
4.      Detect template errors earlier
5.      Better security

When you use the Angular AOT compiler?
When you use the Angular AOT compiler, you can control your app compilation in two ways:
1.      By providing template compiler options in the tsconfig.json file
2.      By specifying Angular metadata

In the following example, the @Component() metadata object and the class constructor tell Angular how to create and display an instance of UserComponent.

import { Component, OnInit } from '@angular/core';

  selector: 'app-user',
  template: '<h2>A User component for {{}}</h2>'
export class UserComponent implements OnInit {
  @Input() data: UserData;

  constructor(private userService: UserService) { ... }

  ngOnInit() {  }

How AOT works?
Explore below links for more details.

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog -
My Books - Book 1 and Book 2 Powered by Blogger.