Sharing Top Content from the Angular-sphere.

Angular CLI – A command line interface for Angular

  • Angular CLI (Command Line Interface) is a high quality development tool-set for developers.
  • Angular CLI features can highly improve the quality of your code and save you a lot of time.
  • With the help of Angular CLI you can easily set up the project and also it allows you to do the following things.Create a new angular applicationRun a development serverAdd features to your existing angular applicationRun your application’s unit testsRun your application’s end-to-end (E2E) testsBuild your application for deployment to productionBefore you can use the Angular CLI, you must have node.js 6.9.0 or above installed on your system, if you already have node.js installed, you can verify the versions by running$ node -v  // Dsiplay the node.js versionRelated: What you need to know about Angular CLI to improve your codeInstalling Angular CLITo install CLI, run$ npm install -g @angular/cliThat’s it!
  • Now you can start using the CLI to build your applications.Creating a New Angular ApplicationTo create new app, just run$ ng new my-appAt this point you have a working Angular application and your new directory my-app looks like Running Your ApplicationTo preview your new application in your browser, navigate to its directory$ cd my-appand run$ ng serveYou can now open your browser and navigate to http://localhost:4200/ to see your application in actionGenerate Parts of Your ApplicationUsing ng generate command you can create a new component, Directive, Services, Module, Class, Pipe, Route and so on.You can use the ng generate (or just ng g) command to add features to your existing application:Add a class to your applicationng generate class my-new-classAdd a component to your applicationng generate component my-new-componentAdd a directive to your applicationng generate directive my-new-directiveAdd an enum to your applicationng generate enum my-new-enumAdd a module to your applicationng generate module my-new-moduleAdd a pipe to your applicationng generate pipemy-new-pipeAdd a service to your applicationng generate service my-new-serviceAngular-cli will add reference to components, directives and pipes automatically in the app.module.ts.Building Your Application for ProductionRunning ng serve builds and bundles your Angular application automatically to a virtual file system during development.
  • However, when your application is ready for production, you will need real files that you can deploy to your server.To build and bundle your application for deployment, run:$ ng buildReference

Angular CLI is a high quality development tool-set for developers. It’s features can highly improve the quality of your code and save you a lot of time

@TrigentSoftware: #Angular CLI – A command line interface for Angular.. Read blog! #angular4 #Angular2…

Angular CLI (Command Line Interface) is a high quality development tool-set for developers. Angular CLI features can highly improve the quality of your code and save you a lot of time. The big part of getting started with Angular is the set up. With the help of Angular CLI you can easily set up the project and also it allows you to do the following things.

Before you can use the Angular CLI, you must have node.js 6.9.0 or above installed on your system, if you already have node.js installed, you can verify the versions by running

$ node -v  // Dsiplay the node.js version

Related: What you need to know about Angular CLI to improve your code

To install CLI, run

$ npm install -g @angular/cli

That’s it! Now you can start using the CLI to build your applications.

To create new app, just run

$ ng new my-app

At this point you have a working Angular application and your new directory my-app looks like

To preview your new application in your browser, navigate to its directory

$ cd my-app

and run

$ ng serve

You can now open your browser and navigate to http://localhost:4200/ to see your application in action

Using ng generate command you can create a new component, Directive, Services, Module, Class, Pipe, Route and so on.

You can use the ng generate (or just ng g) command to add features to your existing application:

Add a class to your application

ng generate class my-new-class

Add a component to your application

ng generate component my-new-component

Add a directive to your application

ng generate directive my-new-directive

Add an enum to your application

ng generate enum my-new-enum

Add a module to your application

ng generate module my-new-module

Add a pipe to your application

ng generate pipemy-new-pipe

Add a service to your application

ng generate service my-new-service

Angular-cli will add reference to components, directives and pipes automatically in the app.module.ts.

Running ng serve builds and bundles your Angular application automatically to a virtual file system during development. However, when your application is ready for production, you will need real files that you can deploy to your server.

To build and bundle your application for deployment, run:$ ng build

Angular CLI – A command line interface for Angular

Comments are closed, but trackbacks and pingbacks are open.