Top 10 Angular 8/9 Interview Questions and Answers to Know in 2020
Ans: - Promises:
return a single value
not cancellable
more readable code with try/catch and async/await
Observables:
work with multiple values over time
cancellable
support map, filter, reduce and similar operators
use Reactive Extensions (RxJS)
an array whose items arrive asynchronously over time
Ans: - Each Angular app gets compiled internally. The Angular compiler takes in the JS code, compiles it and then produces some JS code. This happens only once per occasion per user. It is known as AOT (Ahead-Of-Time) compilation.
Ans: - ngOnInit () is a lifecycle hook that is called after Angular has finished initializing all data-bound properties of a directive.
Ans:- Lazy loading is one of the most useful concepts of Angular Routing and brings down the size of large files. This is done by lazily loading the files that are required occasionally.
Angular 8 comes up with support for dynamic imports in our router configuration. This means that we use the import statement for lazy loading the module and this will be understood by the IDEs, webpack, etc.
Angular7:
Angular 8:
New with Angular 8, loadChildren expects a function that uses the dynamic import syntax to import your lazy-loaded module only when it’s needed. As you can see, the dynamic import is promise-based and gives you access to the module, where the module’s class can be called.
Ans: We create a decorator called Dummy.
function Dummy(target) {
dummy.log(‘This decorator is Dummy’, target);
}
Ans: ng generate class Dummy [options]
Alternative- use URL link- https://update.angular.io/
Ans: - Some of the best Angular CLI commands that enhances developers’ productivity are
Output:- highlight me!
Ans:- The key components of Angular are Components, Modules, templates, services and metadata.
Components are basic building blocks that control HTML views. Modules are the set of these building blocks like components, directives and many others. Simply put, each logical piece of code is a module. Templates represent the views of the angular application. With Metadata, you can add more data to Angular class.
#angular #angular8 #angular9