Angular Interview Questions and Answers 2024 | Angular 17 | Part 2
Question 1: What is Angular Directives?
Directives in Angular are markers on a DOM element that tells Angular to attach a specific behavior to that DOM element or even transform it and its child elements. There are three kinds of directives in Angular: Component Directives, Attribute Directives, and Structural Directives.
Question 2: Explain the difference between AngularJS and Angular?
AngularJS is the first version of Angular, also known as Angular 1. It is based on JavaScript and has had many limitations. Angular, also known as Angular 2 and above, is a complete rewrite of AngularJS and is based on TypeScript. It is more powerful and efficient than AngularJS.
Question 3: What is Dependency Injection in Angular?
Dependency Injection is a design pattern in which an object receives its dependencies from an external source rather than creating them itself. In Angular, Dependency Injection allows you to define the dependencies of a component in a more declarative way, making your code more modular and easier to test.
Question 4: What is Angular CLI and how do you use it?
Angular CLI is a command-line interface tool that helps you to create, build, test, and deploy Angular applications. To use Angular CLI, you need to install it globally on your machine using npm. Once installed, you can create a new Angular project using the command ‘ng new project-name’ and run it using ‘ng serve’.
Question 5: How do you handle errors in Angular?
In Angular, you can handle errors using the catchError operator in RxJS. You can also use the throwError function to create and throw custom errors in your application. Additionally, you can use Angular’s built-in error handling mechanism to display error messages to the user.
m fresher but still able to understand all things keep it up sir
custom directive was something I have never used. tons of thanks
please do cover angular specific question also as so many new things are there
great thing n efforts you are putting sir
Thank u so much sir i am waiting for this video😍
Sir please cover Rxjs operators also with realtime use