Top 10 Angular 6 Interview Questions You Must Prepare 19.Mar.2024

There are four types of NgModules –

  • Features Module
  • Routing Module
  • Service Module
  • Widget Module
  • Shared Module

The Concepts of Angular Components  -

Components are the most basic building block of a UI in Angular applications and it controls views (HTML/CSS). They also communicate with other components and services to bring functionality to your applications.

Technically components are basically TypeScript classes that interact with the HTML files of the components, which get displayed on the browsers.

The component is the core functionality of Angular applications but you need to know to pass the data into the components to configure them.

Angular executes a pure pipe only when it detects a pure change to the input value. A pure change can be primitive or non-primitive.

Primitive data are only single values, they have not special capabilities and the non-primitive data types are used to store the group of values.

@Pipe({

  name: 'currency'

})

The Angular Team are working on lots of bug fixes, new features and added/update/remove/ re-introduce/ and many more things.

Let’s start to explore all changes of Angular 6 step by step:

Added ng update - This CLI commands will update your angular project dependencies to their latest versions. The ng update is normal package manager tools to identify and update other dependencies.

The NgModule decorator identifies AppModule as a NgModule class.

The NgModule takes a metadata object that tells Angular how to compile and launch the application.

The NgModule importance metadata properties are as follows –

  • providers
  • declarations
  • imports
  • exports
  • entryComponents
  • bootstrap
  • schemas
  • id

BrowserModule – The browser module is imported from @angular/platform-browser and it is used when you want to run your application in a browser.

CommonModule – The common module is imported from @angular/common and it is used when you want to use directives - NgIf, NgFor and so on.

FormsModule – The forms module is imported from @angular/forms and it is used when you build template driven forms.

RouterModule – The router module is imported from @angular/router and is used for routing RouterLink, forRoot, and forChild.

HttpClientModule –The HttpClientModule is imported from @angular/common/http and it used to initiate HTTP request and responses in angular apps. The HttpClient is more modern and easy to use the alternative of HTTP.

Angular executes an impure pipe during every component change detection cycle. An impure pipe is called often, as often as every keystroke or mouse-move.

If you want to make a pipe impure that time you will allow the setting pure flag to false.

@Pipe({

  name: 'currency',

  pure:false

})

A cookie is a small piece of data sent from a website and stored on the user's machine by the user's web browsers while the user is browsing.

The chaining Pipe is used to perform the multiple operations within the single expression. This chaining operation will be chained using the pipe (I).

In the following example, to display the birthday in the upper case- will need to use the inbuilt date-pipe and upper-case-pipe.

In the following example –

{{ birthday | date | uppercase}}

A pipe can accept any number of optional parameters to achieve output. The parameter value can be any valid template expressions. To add optional parameters follow the pipe name with a colon (:). Its looks like- currency: 'INR'

In the following example –

<h2>The birthday is - {{ birthday | date:"MM/dd/yy" }} </h2>

<!-- Output - The birthday is - 10/03/1984 -->