In this article, we are going to discuss the most interview questions asked In the angular interview
1. What is an Angular?
2. Difference between AngularJs and Angular
- 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.
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?