Angular Interview Questions

Angular is one of the most promising languages. Rich in feature set, this technology is worth to work hard for. Below is the list of best Angular interview questions and answers. These questions have been divided as per levels - beginner, intermediate and advanced.

1 .
What Is the Difference Between Class Decorators and Class Field Decorators?
Class decorators appear just before class definition, whereas class field decorators appear just before a field in the class definition. Examples of class decorators are @Component, @NgModule etc… Examples of a class field decorator are @Input, @Output etc…
2 .
What Does {{}} Represent? What Is It Used For? Show an Example
The double curly braces represent interpolation. It is a special syntax. Angular converts it into property binding. You can think of it as an alternate for property binding. The name of the component is written inside the inner curly braces. During execution, the name is replaced by the actual string value of the property. For example,
 
<h2> {{apptitle}} <img src="{{imgname}}" style="height:30px"> </h2> 
 
Angular will evaluate and replace apptitle and imgname with their actual values.
3 .
What Does the Representation [()] Mean?
This is a representation for ngModel used for two-way data binding. It is written as [(ngModel)] = “propertyvalue”.
4 .
What Is a Bootstrapping Module in Angular?
The root module that you bootstrap to launch the application is called as a bootstrapping module. Every Angular application has a bootstrapping module. It is also called as the AppModule. The bootstrapping module is mentioned in the AppModule class.
 
@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, FormsModule, HttpClientModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
5 .
List the Differences Between Just-In-Time (JIT) Compilation and Ahead-Of-Time (AOT) Compilation
With JIT, the compilation happens during run-time in the browser. It is the default way used by Angular. The commands used for JIT compilation are –
ng build ng serve 
 
In AOT compilation, the compiler compiles the code during the build itself. The CLI command for aot compilation is -
ng build --aot ng server –aot
 
AOT is more suitable for the production environment whereas JIT is much suited for local development.
6 .
What Do You Know About the NPM Package?
The components, framework and CLI used by Angular applications are packaged as npm packages. Npm packages can be downloaded using the npm CLI client.