Angular Installation

Go back to Tutorial

The Angular CLI, Angular applications, and Angular itself depend upon features and functionality provided by libraries that are available as npm packages.

You can download and install these npm packages with the npm client, which runs as a node.js application.

The yarn client is a popular alternative for downloading and installing npm packages. The Angular CLI uses yarn by default to install npm packages when you create a new project.

package.json

Both npm and yarn install packages identified in a package.json file. The CLI ng new command creates a default package.json file for your project. This package.json specifies a starter set of packages that work well together and jointly support many common application scenarios. You will add packages to package.json as your application evolves. You may even remove some.

dependencies and devDependencies

The package.json includes two sets of packages, dependencies and devDependencies. The dependencies are essential to running the application. The devDependencies are only necessary to develop the application.

The dependencies section of package.json contains:

  • Angular packages: Angular core and optional modules; their package names begin @angular/.
  • Support packages: 3rd party libraries that must be present for Angular apps to run.
  • Polyfill packages: Polyfills plug gaps in a browser’s JavaScript implementation.

Angular Packages

  • @angular/animations: Angular’s animations library makes it easy to define and apply animation effects such as page and list transitions.
  • @angular/common: The commonly needed services, pipes, and directives provided by the Angular team. The HttpClientModule is also here, in the ‘@angular/common/http’ subfolder.
  • @angular/core: Critical runtime parts of the framework needed by every application. Includes all metadata decorators, Component, Directive, dependency injection, and the component lifecycle hooks.
  • @angular/compiler: Angular’s Template Compiler. It understands templates and can convert them to code that makes the application run and render. Typically you don’t interact with the compiler directly; rather, you use it indirectly via platform-browser-dynamic when JIT compiling in the browser.
  • @angular/forms: support for both template-driven and reactive forms.
  • @angular/http: Angular’s old, soon-to-be-deprecated, HTTP client.
  • @angular/platform-browser: Everything DOM and browser related, especially the pieces that help render into the DOM. This package also includes the bootstrapStatic() method for bootstrapping applications for production builds that pre-compile with AOT.
  • @angular/platform-browser-dynamic: Includes Providers and methods to compile and run the app on the client using the JIT compiler.
  • @angular/router: The router module navigates among your app pages when the browser URL changes.
  • @angular/upgrade: Set of utilities for upgrading AngularJS applications to Angular.

Polyfill packages

Many browsers lack native support for some features in the latest HTML standards, features that Angular requires. “Polyfills” can emulate the missing features. The default package.json installs the core-js package which polyfills missing features for several popular browser.

Support packages

  • rxjs: Many Angular APIs return observables. RxJS is an implementation of the proposed Observables specification currently before the TC39 committee that determines standards for the JavaScript language.
  • js: Angular relies on zone.js to run Angular’s change detection processes when native JavaScript operations raise events. Zone.js is an implementation of a specification currently before the TC39 committee that determines standards for the JavaScript language.

DevDependencies

The packages listed in the devDependencies section of the package.json help you develop the application on your local machine. You don’t deploy them with the production application although there is no harm in doing so.

  • @angular/cli: The Angular CLI tools.
  • @angular/compiler-cli: The Angular compiler, which is invoked by the Angular CLI’s build and serve commands.
  • @angular/language-service: The Angular language service analyzes component templates and provides type and error information that TypeScript-aware editors can use to improve the developer’s experience. For example, see the Angular language service extension for VS Code
  • @types/… : TypeScript definition files for 3rd party libraries such as Jasmine and node.
  • codelyzer: A linter for Angular apps whose rules conform to the Angular style guide.
  • jasmine/… : packages to support the Jasmine test library.
  • karma/… : packages to support the karma test runner.
  • protractor: an end-to-end (e2e) framework for Angular apps. Built on top of WebDriverJS.
  • ts-node: TypeScript execution environment and REPL for node.
  • tslint: a static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors.
  • typescript: the TypeScript language server, including the tsc TypeScript compiler.

NPM, Git and Visual Studio Code Installation

To start working with Angular 2, you need to get the following key components installed.

  • Npm − This is known as the node package manager that is used to work with the open source repositories. Angular JS as a framework has dependencies on other components. And npm can be used to download these dependencies and attach them to your project.
  • Git − This is the source code software that can be used to get the sample application from the github angular site.
  • Editor − There are many editors that can be used for Angular JS development such as Visual Studio code and WebStorm.

npm Installation

Let’s now look at the steps to get npm installed. The official site for npm is https://www.npmjs.com/

Step 1 − Go to the “get stated with npm” section in the site.

Step 2 − In the next screen, choose the installer to download, depending on the operating system. For the purpose of this exercise, download the Windows 64 bit version.

Step 3 − Launch the installer. In the initial screen, click the Next button.

Step 4 − In the next screen, Accept the license agreement and click the next button.

Step 5 − In the next screen, choose the destination folder for the installation and click the Next button.

Step 6 − Choose the components in the next screen and click the Next button. You can accept all the components for the default installation.

Step 7 − Click the Install button.

Step 8 − Once the installation is complete, click the Finish button.

Step 9 − To confirm the installation, in the command prompt you can issue the command npm version. You will get the version number of npm.

Installation of Visual Studio Code

Following are the features of Visual Studio Code −

  • Light editor when compared to the actual version of Visual Studio.
  • Can be used for coding languages such as Clojure, Java, Objective-C and many other languages.
  • Built-in Git extension.
  • Built-in IntelliSense feature.
  • Many more extensions for development.

The official site for Visual Studio code is https://code.visualstudio.com/ and installation steps are

Step 1 − After the download is complete, please follow the installation steps. In the initial screen, click the Next button.

Step 2 − Accept the license agreement and click the Next button.

Step 3 − Choose the destination location for the installation and click the next button.

Step 4 − Choose the name of the program shortcut and click the Next button.

Step 5 − Accept the default settings and click the Next button.

Step 6 − Click the Install button.

Step 7 − In the final screen, click the Finish button to launch Visual Studio Code.

Installing Git

Some of the key features of Git are −

  • Easy branching and merging of code.
  • Provision to use many techniques for the flow of code within Git.
  • Git is very fast when compared with other SCM tools.
  • Offers better data assurance.
  • Free and open source.

The official site for Git is https://git-scm.com/ and installation steps are

Step 1 − After the download is complete, please follow the installation steps. In the initial screen, click the Next button.

Step 2 − Choose the components which needs to be installed. You can accept the default components.

Step 3 − In the next step, choose the program shortcut name and click the Next button.

Step 4 − Accept the default SSH executable and click the Next button.

Step 5 − Accept the default setting of “Checkout Windows style, commit Unix style endings” and click the Next button.

Step 6 − Now, accept the default setting of the terminal emulator and click the Next button.

Step 7 − Accept the default settings and click the Next button.

Step 8 − You can skip the experimental options and click the Install button.

Step 9 − In the final screen, click the Finish button to complete the installation.

Go back to Tutorial

Angular Application Working
Sample Angular Application

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?