Question: What are Angular Observables and why are they used?
|
Answer: Angular Observables are a powerful feature of RxJS library used for handling asynchronous operations
and streams of data in Angular applications.
They are used extensively in Angular for handling HTTP requests, event handling, form handling, and more.
Angular Observables provide operators for transforming, filtering, combining, and manipulating asynchronous data streams in a reactive and efficient manner.
|
Question: What are Angular Animations and how are they implemented?
|
Answer: Angular Animations are a set of techniques and APIs for adding animations to Angular applications.
They allow you to animate HTML elements and components in response to user interactions, route changes, or other events.
Angular Animations are implemented using the @angular/animations module and involve defining animation states,
transitions, keyframes, and triggers using Angular's Animation DSL (Domain-Specific Language).
|
Question: What is Angular Change Detection and how does it work?
|
Answer: Angular Change Detection is the process of detecting and propagating changes made to component
properties or state to the associated views (HTML templates) in an Angular application. Angular uses a mechanism called Zone.js
and a change detection strategy based on dirty checking to detect changes and update the DOM efficiently.
Developers can configure change detection strategies at the component level for optimizing performance.
|
Question: What is Angular ElementRef and Renderer2?
|
Answer: Angular ElementRef is a class that provides access to the underlying native element of a component or directive.
It is used to interact directly with the DOM within Angular components.
The Renderer2 is an Angular service used for manipulating the DOM in a way that is safe for server-side rendering,
web workers, and other environments. It provides methods for creating, querying, modifying, and removing DOM elements and attributes.
|
Question: How can you share data between Angular components?
|
Answer: There are several ways to share data between Angular components:
• Using @Input and @Output decorators for parent-child communication.
• Using Angular services to create a shared service and inject it into components.
• Using Angular Router to pass data between routed components.
• Using BehaviorSubject or other RxJS subjects for cross-component communication.
• Using Angular's component interaction patterns like ViewChild, ContentChild, EventEmitter, etc.
|
Question: What is Angular AOT (Ahead-of-Time) Compilation?
|
Answer: Angular AOT Compilation is a process of compiling Angular application code at build time instead of runtime.
It converts Angular templates and components into highly optimized JavaScript code during the build process,
resulting in smaller bundle sizes, faster rendering, and improved application performance.
The AOT compilation is recommended for production deployments of Angular applications.
|