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.