Angular 2,3,7,8 interview questions

  Angular, Uncategorized

we will discuss the topmost very important Angular 2,3..7,8 interview questions.this questions are commonly asked in every interview.

What is the difference between angularJs and angular Applications?


  1. Angularjs is a javascript library and this is not a framework like (MVC, MVVM..) this application pages will run on the browser directly.
  2. angularJs application is slow compared to angular applications and easy to implement this application
  3. Angularjs core concept was $scope, without scope we can’t communicate between views and controller.
  4. For communicating with views/templates it require controllers.


  1. Angular is a single pages application and framework .this application pages will not run on the browser directly.
  2. angular application is very fast compared to angularJs applications and complex to implement this application.
  3. Angular2 is using Zone.js for detecting changes made in the DOM.
  4. It’s build with components.Template Directives + controllers =    components.

What is typescript?

Typescript is a typed superset of have a compilar It’s compiled to generate JavaScript files.

Typescript will support core object-oriented principles like interfaces and classes, functions, methods… Typescript will reuse all existing javascript libraries, tools

Benefits of TypeScript:

before executing the script the compiler will generate syntax errors if any error is raised easily to finding the errors.

the major benefits of typescript are OOPs principles by using these principals we will reusable and easier to manage the code.

Writing code in typescript is more predictable and is generally easier to debug.

What are Directives and types in angular 4?

In angular Directives are the classes that can change the behavior or appearance of the components by using CSS Classes, CSS Styles, and events.

There are three kinds of directives in Angular:

  1. Components—directives with a template.
  2. Structural directives—change the DOM layout by adding and removing DOM elements.
  3. Attribute directives—change the appearance or behavior of an element

What is the main Feature of Modules?

Main differences between root module and feature module are,

  1. Root module launches the application whereas the feature module will get imported to extend the application.
  2. The feature module can expose or hide its implementation from other modules.
  3. Feature module helps us to partition the application into various sets of functionalities that will be focused on an application business domain, user workflow, and facilities like forms, Http, routing (or) a collection of related utilities. Whereas we can do everything within the root module.
  4. Feature module doesn’t import BrowerModule but CommonModule because the feature is just a part of RootModule so no need to import Browser Module in FeatureModules. To make our feature module to be platform-independent we only need to import CommonModule.

What is Lazy Loading a Module

Lazy loading is the concept of loading the required piece of code only when it’s on-demand, i.e. when NgModule launches the angular application it loads all the components and modules which are declared within, due to this application startup time will be increased and this show impact on the performance of our application.

  1. Eager Component should load in start-up
  2. Lazy Component should load only when we navigate to its module.

Can you explain about HTML form in angular?

In most of the front end applications, we use HTML forms for grouping HTML elements and we provide validations using HTML5 attributes like required, minlength, maxlength, pattern etc.

And every forms do such similar tasks across all applications they are:

  1. Maintain the form state
  2. Tracking which part of the form is valid and which part is invalid
  3. Displaying error message to how to make form valid
  4. Form submitting and resetting

Similarly angular framework provides us alternative strategies to handle the forms they are:

  1. Template Driven Forms (similar to Angular1 forms)
  2. Model-Driven /Reactive Forms

what are the Angular provides to us built-in validators?

Angular provides us built-in validators via standard HTML5 attributes such as, custom validation

  1. Required
  2. Maxlength
  3. Minlength
  4. Pattern


And our FormContol( ) can be overloaded by providing the Validators

  1. first parameter: Initial value of the control
  2. second parameter: It contains either a single validator or list of validators

Modify the above FormComponent as follows,

  1. firstName (required, pattern which allows only alphanumeric but not special characters)
  2. lastName (required, maxlength of 10 characters)

Build user skills with our top most Articles

Angular 8 crud operation example

Implementing routing in angular 4 with example

Crud operations in angular 7 using web API

pipes in angular 4 examples