Monday, 29 May 2017

Angularjs 2 Interview Questions and Answers

Angularjs 2 Interview Questions and Answers


Question: Why AngualrJS2 over AngualrJS1?
  1. Angular 2 is simpler and faster than Angular 1.
  2. You can update the large data sets with minimal memory overhead.
  3. It will speed up the initial load through server side rendering.



Question: What are the feature of AngualrJS2?
  1. Angular 2 is faster than Angular 1
  2. Angular 2 is easier than Angular 1
  3. It supports old browsers also including IE9+ and Android 4.1+.
  4. It is a cross platform framework.
  5. Angular 2 is mainly focused on mobile apps.
  6. Code structure is very simplified than the previous.



Question: How to install AngualrJS2 in NodeJS?
  1. Create an folder and go inside that folder using command line.
  2. Create en empty file package.json and add following contents.
    {
      "name": "angular2-demo",
      "version": "1.0.0",
      "scripts": {
        "start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
        "tsc": "tsc",
        "tsc:w": "tsc -w",
        "lite": "lite-server",
        "typings": "typings",
        "postinstall": "typings install"
      },
      "license": "ISC",
      "dependencies": {
        "angular2": "2.0.0-beta.7",
        "systemjs": "0.19.22",
        "es6-promise": "^3.0.2",
        "es6-shim": "^0.33.3",
        "reflect-metadata": "0.1.2",
        "rxjs": "5.0.0-beta.2",
        "zone.js": "0.5.15"
      },
      "devDependencies": {
        "concurrently": "^2.0.0",
        "lite-server": "^2.1.0",
        "typescript": "^1.7.5",
        "typings":"^0.6.8"
      }
    }
  3. Create an empty file tsconfig.json and add following contents.
    {
      "compilerOptions": {
        "target": "es5",
        "module": "system",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false
      },
      "exclude": [
        "node_modules",
        "typings/main",
        "typings/main.d.ts"
      ]
    }
  4. Create an empty file typings.json and add following contents.
    {
      "globalDependencies": {
        "core-js": "registry:dt/core-js",
        "jasmine": "registry:dt/jasmine",
        "node": "registry:dt/node"
      }
    }
  5. Execute following command from command line.
    npm install