What is Angular ?

An Angular is a JavaScript Framework which allows to create reactive Single-Page-Applications. 

IDEs : Visual Studio Code (Free) , Webstrom (Great for development but not free)

What is NPM?

NPM stands for node package manager. It is used for installing dependencies for javascript packages.

What is Angular CLI? List the command to install Angular CLI?

Angular CLI is Command Line Interface for Angular that runs Webpack.You can use npm install -g @angular/cli command to install angular CLI.

How to create a new project in angular using CLI?

After installing Angular CLI run ng new project-name command to create a new Angular project.

List the types of Data Binding supported by Angular5?

Angular 5 supports four types of Data Binding They are

  • String Interpolation
  • Property Binding
  • Event Binding
  • Two-way-binding

How to run Angular5 application locally during development?

ng serve command is used to run Angular5 application locally during development.To start development server on specific port ng serve -p aPortNumber command is used.

What is Angular ?

Angular  is a completely revived component-based framework in which an application is a tree of loosely coupled components. It is a more advanced version of angularJS. It is more of an “all in one” framework so it also helps in creating a single website without getting trapped into different JS frameworks. An Angular 2 is a modular framework in which our code is divided into individual procedures that offer a similar kind of functionality, hence improving the testing, up gradation and maintenance of the application. It has a lot of useful features such as- server-side rendering, cross-platform, and supports more languages than any other framework. It is a new typescript framework built around the concept of components which is paving the way for a better and spacious development. We can even make hybrid applications using Angular 2 which gives us a sharp edge by providing us the flexibility to use the same standard codes for developing other applications.

List some advantages of Angular 2 over Angular1.

Angular (All version from Angular 2 are just called Angular) is a re-written version of Angular1 and not an update. The best way to compare Angular 2 and Angular 1 is by finding out the new features in Angular 2. This way we will be able to find out the advantages of Angular 2 over Angular1 precisely. So, some of the advantages of Angular 2 are:-

Angular 2 Angular1
Angular 2 is a mobile-oriented framework Whereas Angular1 was not developed with mobile base in mind.
Angular 2 is a versatile framework, i.e. we have more choices for languages. We can use ES5, ES6, Typescript or Dart to write an Angular 2 code Whereas an Angular1 code can written by using only ES5, ES6 and Dart. We don’t have many choices of language in Angular1.
Nowadays, the controllers are replaced by components and Angular 2 is completely component based. Whereas Angular1 was based on controllers whose scope is now over.

List the differences between Angular components vs. directives.

Apart from components, directives are also used in Angular 2 which allows us to attach behavior to elements in DOM. There are certain differences between the components and directives in Angular 2. They are: –

  1. In Angular, a component is a directive with a view whereas a directive is a decorator with no view. Components are the specific type of directive that allows us to utilize web component functionality throughout our application. Whereas, Directive is the mechanism by which we attach behavior to elements.
  2. A component is used to break up the application into smaller components. Whereas, Directive is used to design the re-usable components.
  3. Components can be used to define pipes. Whereas, We cannot define pipes using directives.
  4. Components can be present per DOM element. Whereas, Directive is used to add behavior to an existing DOM element.

What is Traceur Compiler?

Traceur is a compiler which takes ECMAScript and compiles it down to regular Javascript that runs in your browser. Traceur can be used in several ways like- typing or pasting the ES6 code into the read-eval-print-loop page, or by including traceur in the web page and compiling ES6 code content on the fly, or many other ways. Even traceur is written in ES6, compiled to ES5. The main goal of a traceur compiler is to inform the designs of Javascript features and allows us to write the code in a better manner. Nowadays, traceur compilers are broadly used in Angular 2 platform. It also supports transpilling and type checking via type annotations.

List the modern browsers supported by Angular 2.

Angular supports most of the recent browsers some of which are-

  • Google Chrome
  • Firefox
  • Edge
  • IE for versions 9-11
  • Safari
  • iOS 7.1
  • Android 4.1
  • IE Mobile

When to use Ngoninit and constructor in Angular 2?

Constructors are used for initializing class members and also for dependency injection. Ngonlnit is used for the initialization work. Both of these methods are called when the component is created. It is really important that we should know, when to and how to use them. These are used for providing the best structure for your component’s code. A constructor method is a pre-defined method in the constructor class which is only called when the class is instantiated. It is also used for properly initializing the fields. Constructor in Angular 2 is used to create a new instance of the class. Ngonlnit is the class we import when we implement the constructor in order to use it in a class. The method used in this case is ngOnlnit(). This method helps in initializing the directive or the component after the data bound properties are displayed and the directive or components input are set.