Learn Angular CLI Day 13

Lecture 13 : Learn Angular CLI

Installing Angular CLI :


  • Major versions of Angular CLI follow the supported major version of Angular, but minor versions can be released separately.

  • Install the CLI using the npm package manager: 

             npm install -g @angular/cli

  • To create, build, and serve a new, basic Angular project on a development server, go to the parent directory of your new workspace use the following commands:

             ng new my-first-project

             cd my-first-project   

                    ng serve

Agular CLI :
  • Angular CLI is the official tool for initializing and working with Angular projects.

  • It saves you from the hassle of complex configurations and build tools like TypeScript, Webpack.

Webpack : Webpack is a popular module bundler, a tool for bundling application source code in convenient chunks and for loading that code from a server into a browser.

You determine what Webpack does and how it does it with a JavaScript configuration file...

                    webpack.config.js

  • Angular CLI makes it easy to start with any Angular project. Angular CLI comes with commands that help us create and start on our project very fast.

  • Let us now go through the commands available to create a project, a component and services, change the port, etc.

Folder Structure :

Configuration :

ng commands :

ng new :
  • The Angular CLI makes it easy to create an application that already works, right out of the box.

  • Syntax

          ng new <name> [options]

                 ng n <name> [options] 
  • ng new command creates a workspace of given name with a default Angular Application.

  • It provides interactive prompts to set optional configurations.

  • All prompts have default values to choose.

  • Options are optional parameters.

ng serve :
  • Easily test your app locally while developing. Builds and serves your app, rebuilding on file changes.

  • Syntax

                ng serve <project> [options] 

                ng s <project> [options]

  • ng serve command builds and serve the application.

  • It rebuilds the application if changes occur.

  • Here project is the name of the application as defined in angular.json.

  • Options are optional parameters.

Comments

Popular posts from this blog

Basic Concept In C Sharp Day 16

VS Code In JavaScript Day 6

ASP.NET MVC Interview Questions Part - II Day 26