Angular 2 Interview Questions and Answers

Angular 2 is an open source JavaScript framework that developed using TypeScript. It is an improved version of Angular framework but fundamentally a different framework. Unlike Angular that's mainly focus on controllers, Angular 2 is mainly focus on component and modules to develop web applications. If you're a Angular developer and looking for Angular 2 interview questions and answers, then you're here at right place.
Here we have listed some most asked Angular 2 interview questions and answers for beginners and experienced Angular developers.

Q1. What is different between Angular 2 and Angular?

Ans. Angular 2 is totally different than Angular. It is based on component and modules instead of controllers and scope to develop web applications.

Q2. What are the advantages of using Angular 2 ?

Ans. There are following advantages of using Angular 2 instead of Angular.

  • Its more structured framework than Angular to manage applications.

  • Angular 2 is totally based on component and module to develop web applications.

  • Angular 2 is fully mobile oriented framework to develop mobile applications.

  • It supports mulitple languages to develop application such as Typescript, ES5, ES6 etc.

Q3. What is components in Angular2?

Ans. The components are used in Angular 2 framework to develop web applications into modules. Angular 2 has following components:

  • Modules

  • Component

  • Templates

  • Metadata

  • Service

Q4. What is directive in Angular 2?

Ans. In Angular 2, the directive is a custom HTML that 's used to inherit HTML features in smart way.
Q5. How to declare component in Angular 2?

Ans. In Angular 2, components are the main building block of an Angular application. We can say that the Angular application is a tree of Angular components and components are subset of directives. We will declare Angular 2 components like below:
@Component({selector: 'test', template: '{{title}}!'})
class Test {
title: string = 'This is test.';

Q6. What is template in Angular 2?

Ans. In Angular 2, template is HTML and used to render components in views.

Q7. What is Typescript in Angular 2?

Ans. Angular 2 allows to code using Typescript language. Typescript is a typed super set of JavaScript means all JavaScript code is valid Typescript code. Unlike JavaScript function based coding, Typescript allows to create classes, modules, namespaces etc.

Q8. What is routing in Angular 2?

Ans. Routing is used in Angular 2 to directing to different pages according to options to render Angular components.

Q9. What's the use of @Inputs in Angular 2?

Ans. In Angular 2, @Input is used to send data into controller and templates to perform action on data before render it.

Q10. What's the used of @Outputs in Angular 2?

Ans. The @Outputs is used to bind property of components to send data from one component to another another component. This is used to handle one way communication from child to parent component.

You may like these posts