Home » Angular Interview Questions And Answers

Angular Interview Questions And Answers

Angular Interview Questions and Answers

In this article, we are going to discuss the most interview questions asked In the angular interview

1. What is an Angular?

Angular is a javascript platform and framework for building single-page applications by using HTML and typescript

2. Difference between AngularJs and Angular

  • Language– In AngularJs we use Javascript and in Angular we use Typescript language
  • Mobile Development Support – AngularJs not support for mobile development but Angular support mobile devlopment
  • CLI Support – No Support for Angularjs but Angular provide the CLI(Command Line Interface)
  • SEO(Search engine optimization)– We can’t do SEO in AngularJs but its possible in Angular
  • Server Side Rendering – Its not possible in AngularJs but its achievable in Angular
  • Architecture – In AngularJs Controller based architecture is there but for Angular Component based architecture present.

3. What are directives in angular?

Directives are angular syntaxes we write inside the HTML element or Classes that add additional behavior to the elements in the angular application.

Example: ngClass, ngStyle, ngModel, *ngIf, *ngFor
ngClass– adds and removes a set of CSS classes.

ngStyle– adds and removes a set of HTML styles.

NgModel– adds two-way data binding to an HTML form element.

*ngIf– Hide and show element based on condition

*ngFor– Looping the array or list over the HTML element

4. Types of directives in angular?

There are three types of directives in angular components, attributes, and structural directives

Components directives– The selector of the component is used as a directive to render the template.

  <app-root>
  </app-root>

Attribute directives– Responsible for the appearance, behavior of the HTML element, component. example – ngClass, ngStyle and ngModel

Structural directives– Change the layout of the element by adding and removing the DOM element example: *ngIf, *ngFor

5. What is the use of the package.json file and node_modules folder?

package.json file contains the information about the application like packages names and their versions

node_modules folder where all the packages get installed.

6. What is Typescript?

Typescript is a superset of javascript, it ads the types to the javascript

Tags: