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';

@Component({
  selector: 'app-user',
  template: '<h2>A User component for {{data.name}}</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

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 Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.
^