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.

Prerequisites

Before you begin, make sure your development environment includes Node.js® and an npm package manager.

  • js – Angular requires Node.js version 8.x or 10.x. To check your version, run node -v in a terminal/console window. To get Node.js, go to nodejs.org.
  • npm package manager – Angular, the Angular CLI, and Angular apps depend on features and functionality provided by libraries that are available as npm packages. To download and install npm packages, you must have an npm package manager. To check that you have the npm client installed, run npm -v in a terminal/console window.

To start working with Angular, 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.

The Angular CLI

The Angular CLI is a tool to initialize, develop, scaffold and maintain Angular applications. To install the Angular CLI (Command Line Interface) tool, which helps you start new Angular 7 projects as well as assist you during development, you will need Nodejs. Make sure you install this with the default options and reload your command line or console after doing so.

Install the Angular CLI – You use the Angular CLI to create projects, generate application and library code, and perform a variety of ongoing development tasks such as testing, bundling, and deployment. Install the Angular CLI globally. To install the CLI using npm, open a terminal/console window and enter the following command: npm install -g @angular/cli

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.
  • @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.

 

Go back to Tutorial

Get industry recognized certification – Contact us

Menu