Q1. What are the key features of Angular?
Key features include: component-based architecture, templates with data binding, dependency injection, built-in directives, RxJS for reactive programming, Angular CLI for development, routing for navigation, forms handling (template-driven and reactive), HTTP client for API communication, and comprehensive testing support. Angular also provides cross-platform development for web, mobile, and desktop.
Q2. What is data binding in Angular?
Data binding is the automatic synchronization of data between the model (component) and the view (template). Angular provides four forms: interpolation ({{ }}), property binding ([property]="value"), event binding ((event)="handler"), and two-way binding ([(ngModel)]). This reduces boilerplate code and keeps the UI in sync with the data.
Q3. What is dependency injection in Angular?
Dependency injection (DI) is a design pattern where a class receives its dependencies from external sources rather than creating them internally. Angular has a built-in DI framework that provides dependencies to components, services, and other classes. It promotes loose coupling, testability, and reusability. Dependencies are registered with providers and injected via constructors.
Q4. What is the Angular CLI?
The Angular CLI (Command Line Interface) is a powerful tool that simplifies Angular development. It helps create new projects, generate components, services, modules, and other artifacts. It also handles building, testing, and deploying applications. Common commands: ng new, ng generate, ng serve, ng build, ng test. The CLI enforces best practices and project structure.
Q5. What is RxJS and how is it used in Angular?
RxJS (Reactive Extensions for JavaScript) is a library for reactive programming using Observables. Angular heavily uses RxJS for handling asynchronous operations like HTTP requests, event handling, and form value changes. It provides powerful operators for transforming, combining, and managing data streams. Common uses include HttpClient, Router events, and reactive forms.
