Interview Questions Related to Angular


Q11: Explain REST in Angular?

Ans: REST is the abbreviation of REpresentational State Transfer. Actually, it is an API style that functions on the HTTP request. This works when the requested URL identifies the data that must be processed. After that, on that requested data, the HTTP technique determines the particular operation that is required to be performed. .
.
Hence, the APIs that work on this approach are called RESTful APIs. In other words, the job of the Angular framework is to build responsive and intuitive applications. These applications run as a single web page once they are downloaded. When the REST services are utilized, they reduce the loading times by permitting the user to request only the data and operations that they require.

Q12: What do you understand by AOT?

Ans: The full form of AOT is the Angular Ahead-of-Time compiler. Its name pretty much defines the function of this compiler. When the build process is happening, it pre-compiles the application components with their templates. The Angular applications for which AOT is used for compilation have less launching time. .
.
Furthermore, you can instantly execute the components of these applications. For this, you don’t even need to require client-side compilation. In such applications, templates are enclosed in the components as code. With it, you will not need to download the Angular compiler. Due to that, you are saved from doing a tiring task. AOT compiler can remove the directives that are not used, and they are expelled out by a tree-shaking tool.

Q13: What is the meaning of bootstrapping in Angular?

Ans: Bootstrapping is the simplest concept in angular. It is the process of starting the Angular app. Typically, two types of bootstrapping are supported by Angular .i.e, automatic and manual bootstrapping.

  • Automatic Bootstrapping: you can do it by the addition of the ng-app directive to the root of the application on the tag. Also, in case you want angular to automatically bootstrap your application. The module gets loaded when Angular explores the ng-app directive related to it. Then, it ends up compiling the DOM.
  • Manual Bootstrapping: as you have to do it by yourself, you have more control over it. You can decide the way and time to initialize your Angular application. It is beneficial if you want to carry out an operation before Angular starts resulting in compiling the page.

Q14: Explain Angular Modules?

Ans: Every Angular app is modular. Due to this reason, they all follow a modularity system that is referred to as NgModules. These are nothing but are the containers that keep a cohesive block of code devoted especially to an application domain, maybe a closely related set of capabilities, or a workflow. In general, these modules have components, service providers, and many different code files. .
.
The scope of all these is defined by the containing NgModule. Modules are great because they turn any code into more manageable, testable, and readable code. For instance, when you are building a website, footer, header, all of the sections become part of a module.

Q15: Cite the different types of filters?

Ans: Angular supports many filters. We have written these filters below.

  • Currency: this formats any number to a currency format.
  • Date: this formats a date to a specified format.
  • Filter: picks a subset of items from an array of objects.
  • JSON: converts an object to a JSON string.
  • Limit: restricts a string to a certain number of elements or characters.
  • Lowercase: a string is formatted to a lower case.
  • Number: number is formatted to a string.
  • OrderBy: with the help of the expression, the array is ordered.
  • Uppercase: here, a string is formatted to upper case.