{"id":16953,"date":"2017-04-26T12:15:17","date_gmt":"2017-04-26T09:15:17","guid":{"rendered":"https:\/\/www.webcodegeeks.com\/?p=16953"},"modified":"2017-04-25T13:36:45","modified_gmt":"2017-04-25T10:36:45","slug":"getting-started-angular-cli-commands","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/","title":{"rendered":"Getting Started With Angular CLI Commands"},"content":{"rendered":"<p>I have been a developer for the past 20+ years and have used some of the \u2018big\u2019 languages (C, C++, C#, Java) throughout. I dabbled with JavaScript back before there were frameworks, when its use was to dynamically hide this control or disable that control. While it can still do those trivial tasks, JavaScript has come a long way with a framework for everything now: front-ends, back-end, sockets, 2D\/3D games, connecting to all kinds of databases, and robots, among others.<\/p>\n<p>Over the last few years, I have started looking back into JavaScript. The projects I have been working didn\u2019t require any JavaScript, so I have been trying to pick it up here and there through through online tutorials, videos, and podcasts. I chose Angular to get my feet wet. I\u2019m not saying that Angular is the ultimate framework and that everyone should use it, but it can most certainly do quite a few things.<\/p>\n<p>I keep coming back to a tool that has helped my journey through Angular-land: <strong>the Angular CLI<\/strong>. The CLI is a useful tool that can help set up and add different elements to your projects. It follows some of the best practices that have been laid down by the Angular team, even handling some of the plumbing for you so that things will work well together.<\/p>\n<p>This post will show some of the basic commands available within the CLI. While we won\u2019t go into every different command provided, we will look at some of the basic commands that can help get a project started and built. We will pay particular attention to the different commands and what they produce, as far as application structure and file layout is concerned.<\/p>\n<p>So do keep in mind that it is not my purpose to describe all the different elements and how they are used (maybe a topic for future articles); we will just be looking at what the CLI lays down. Let\u2019s get started.<\/p>\n<h2>What is Angular CLI?<\/h2>\n<p><a href=\"https:\/\/github.com\/angular\/angular-cli\" target=\"_blank\">Angular CLI<\/a> is a command line tool that can aid in creating new Angular projects from scratch or adding various elements\u00a0to an existing Angular application.\u00a0This tool is not essential in building an Angular project, but it does provide several benefits, especially for someone who does not have much experience with Angular.<\/p>\n<p>This tool will create a new project that is ready to run immediately and will generate a <em>Hello World-esque<\/em> project. It will create all needed plumbing to get everything up and running in a matter of minutes, generating an application structure that is based on best practices for an Angular project. When adding new elements, it will create these elements in the appropriate directory structure, generate\u00a0source code, and in some cases add code to other elements within the project so that the new elements can be used wherever needed.<\/p>\n<h3>Prerequisites<\/h3>\n<p>In order to install Angular CLI, the following should be installed in the development environment:<\/p>\n<ul>\n<li><a href=\"https:\/\/nodejs.org\/en\/\" target=\"_blank\">node<\/a> (at least version 4.0)<\/li>\n<li><a href=\"https:\/\/www.npmjs.com\/\" target=\"_blank\">npm<\/a> (at least version 3.0)<\/li>\n<\/ul>\n<h3>Installation<\/h3>\n<p>Installing Angular CLI is as easy as typing the follow command:<\/p>\n<pre class=\"brush:perl\">npm install -g angular-cli<\/pre>\n<p>This will globally install angular-cli. This will allow for the use of all the <code>ng<\/code> commands. As of this writing, this installs version 1.0.0-beta.28.3 of the Angular CLI.<\/p>\n<h3>Create New Project<\/h3>\n<p>To create a new project, either <code>ng new<\/code> or <code>ng init<\/code> can be used. The main difference between these commands is that <code>ng new<\/code> will create a new directory and <code>ng init<\/code> will create a new project in the current directory.<\/p>\n<p>Issue the following command to create a new project called <code>my-project<\/code>.<\/p>\n<pre class=\"brush:perl\">ng new my-project<\/pre>\n<p>This will cause several things to happen:<\/p>\n<ul>\n<li>directory <code>my-project<\/code> will be created<\/li>\n<li>directory structure and source files will be generated<\/li>\n<li>any needed dependencies will be installed<\/li>\n<li>TypeScript will be configured<\/li>\n<li>Karma test runner will be configured<\/li>\n<li>Protractor end-to-end test runner will be configured<\/li>\n<li>environment files will be created<\/li>\n<\/ul>\n<p>Here is a screenshot of the project structure that was generated:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-new.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16955\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-new.png\" alt=\"\" width=\"209\" height=\"574\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-new.png 209w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-new-109x300.png 109w\" sizes=\"(max-width: 209px) 100vw, 209px\" \/><\/a><\/p>\n<p>The purpose of this article is not to go into all the files that are generated but there are a few keys files to point out:<\/p>\n<ul>\n<li><code>src\/app<\/code> directory: This directory contains source code, css, and html files. This is where most of the work will be done.<\/li>\n<li><code>app.module.ts<\/code>: Main <code>NgModule<\/code> for the application. Everything must belong to a module (even other modules).<\/li>\n<li><code>main.ts<\/code>: Bootstraps your application.<\/li>\n<li><code>index.html<\/code>: Main html file for your application.<\/li>\n<\/ul>\n<h3>Run Application<\/h3>\n<p>Change to the <code>my-project<\/code> directory and run the following:<\/p>\n<pre class=\"brush:perl\">ng serve<\/pre>\n<p>Then open a browser and point it to <code>http:\/\/localhost:4200\/<\/code>. The following should be displayed:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-Running-screenshot.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16956\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-Running-screenshot.png\" alt=\"\" width=\"400\" height=\"244\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-Running-screenshot.png 400w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-Running-screenshot-300x183.png 300w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>Nothing spectacular, but a running application nonetheless.<\/p>\n<p>Note:\u00a0Running <code>ng serve<\/code> from the command line will not return control back to the command prompt. This will detect changes that are made to the project, recompile the project, and then refresh the web page.<\/p>\n<h2>Adding Other Elements<\/h2>\n<p>To add other elements to your application, either <code>ng generate<\/code> or <code>ng g<\/code> command can be used.\u00a0There are many elements that can be created, but only the following elements will be covered in this article:<\/p>\n<ul>\n<li>class<\/li>\n<li>interface<\/li>\n<li>enumeration<\/li>\n<li>component<\/li>\n<li>service<\/li>\n<li>module<\/li>\n<\/ul>\n<p>In order to use Angular CLI to add these elements to your application, go to the <code>my-project<\/code> directory and issue the following commands.<\/p>\n<p>Note: After issuing commands, Angular CLI will display files that are generated and where they are created at.<\/p>\n<h3>Create A Class<\/h3>\n<p>To create a new class, run the following:<\/p>\n<pre class=\"brush:perl\">ng g class my-class-a<\/pre>\n<p>This will create a file called <code>my-class-a.ts<\/code> under the <code>src\/app<\/code> directory. Notice that it will add <code>.ts<\/code> after the name provided.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-class-my-class-a.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16957\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-class-my-class-a.png\" alt=\"\" width=\"400\" height=\"301\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-class-my-class-a.png 400w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-class-my-class-a-300x226.png 300w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p>This file is a basic class file with no decorators generated. It will export a class called <code>MyClassA<\/code> (removes dashes and uses camel case).<\/p>\n<p><strong>my-class-a.ts<\/strong><\/p>\n<pre class=\"brush:perl\">export\u00a0class\u00a0MyClassA\u00a0{\r\n}<\/pre>\n<h3>Create An Interface<\/h3>\n<p>To create a new interface, run the following:<\/p>\n<pre class=\"brush:perl\">ng g interface my-interface-a<\/pre>\n<p>This will create a file called <code>my-interface-a.ts<\/code> under the <code>src\/app<\/code> directory. Notice that it will add <code>.ts<\/code> after the name provided.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-interface-my-interface-a.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16958\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-interface-my-interface-a.png\" alt=\"\" width=\"300\" height=\"275\" \/><\/a><\/p>\n<p>This file is a basic interface\u00a0file with no decorator generated. It will export a class called <code>MyInterfaceA<\/code> (removes dashes and uses camel case).<\/p>\n<p><strong>my-interface-a.ts<\/strong><\/p>\n<pre class=\"brush:perl\">export interface my-interface-a\r\n}<\/pre>\n<h3>Create An Enumeration<\/h3>\n<p>To create a new enumeration, run the following:<\/p>\n<pre class=\"brush:perl\">ng g enum my-num<\/pre>\n<p>This will create a file called <code>my-enum.enum.ts<\/code> under the <code>src\/app<\/code> directory. Notice that it will add <code>.enum.ts<\/code> after the name provided.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-enum-my-enum-300x278.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16959\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-enum-my-enum-300x278.png\" alt=\"\" width=\"300\" height=\"278\" \/><\/a><\/p>\n<p>This file is a\u00a0basic enumeration\u00a0file with no decorator generated.\u00a0It will export a class called <code>MyEnum<\/code> (removes dashes and uses camel case).<\/p>\n<p><strong>my-enum.enum.ts<\/strong><\/p>\n<pre class=\"brush:perl\">export\u00a0enum\u00a0MyEnum\u00a0{\r\n}<\/pre>\n<p>Creating a class, interface, or enumeration are basic constructs and could be created manually just as easily, but the CLI will format them according to best practices.\u00a0Now on to things that need a little more to them.<\/p>\n<h3>Create A Component<\/h3>\n<p>To create a new component, run the following:<\/p>\n<pre class=\"brush:perl\">ng g component my-component-a<\/pre>\n<p>This will do several things:<\/p>\n<ul>\n<li>create a directory called <code>my-component-a<\/code> under <code>src\/app<\/code> directory<\/li>\n<li>generate four files under that directory\n<ul>\n<li><code>my-component-a.component.css<\/code>\n<ul>\n<li>Contains any css that would be needed for this component<\/li>\n<li>Optional file that is pointed to by the component.ts file<\/li>\n<\/ul>\n<\/li>\n<li><code>my-component-a.component.html<\/code>\n<ul>\n<li>Contains any html that would be needed for this component<\/li>\n<li>Optional file that is pointed to by the component.ts file<\/li>\n<li>html could be contained within the component.ts file, if desired<\/li>\n<\/ul>\n<\/li>\n<li><code>my-component-a.component.spec.ts<\/code>\n<ul>\n<li>unit test skeleton for this component<\/li>\n<\/ul>\n<\/li>\n<li><code>my-component-a.component.ts<\/code>\n<ul>\n<li>exports a class called <code>MyComponentAComponent<\/code><\/li>\n<li>implements an interface called <code>OnInit<\/code><\/li>\n<li>generates empty function called <code>ngOnInit<\/code>\u00a0for <code>OnInit<\/code> interface<\/li>\n<li>generates empty constructor function<\/li>\n<li>decorates class with <code>@Component<\/code>\n<ul>\n<li>add selector for component, <code>app-my-component-a<\/code><\/li>\n<li>adds templateUrl, points to generated html file for component<\/li>\n<li>adds styleUrls array, points to generated css file for component<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>modifies <code>app.module.ts<\/code> file, added <code>MyComponentAComponent<\/code> to declarations (every component has to belong to a module)<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-component-my-module-a_my-component-a.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16960\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-component-my-module-a_my-component-a.png\" alt=\"\" width=\"387\" height=\"620\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-component-my-module-a_my-component-a.png 387w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-component-my-module-a_my-component-a-187x300.png 187w\" sizes=\"(max-width: 387px) 100vw, 387px\" \/><\/a><\/p>\n<p><strong>my-component-a.component.ts<\/strong><\/p>\n<pre class=\"brush:perl\">import\u00a0{\u00a0Component,\u00a0OnInit\u00a0}\u00a0from\u00a0'@angular\/core';\r\n\r\n@Component({\r\n\u00a0\u00a0selector:\u00a0'app-my-component-a',\r\n\u00a0\u00a0templateUrl:\u00a0'.\/my-component-a.component.html',\r\n\u00a0\u00a0styleUrls:\u00a0['.\/my-component-a.component.css']\r\n})\r\nexport\u00a0class\u00a0MyComponentAComponent\u00a0implements\u00a0OnInit\u00a0{\r\n\r\n\u00a0\u00a0constructor()\u00a0{\u00a0}\r\n  \r\n\u00a0\u00a0ngOnInit()\u00a0{\r\n\u00a0\u00a0}\r\n\r\n}<\/pre>\n<p><strong>app.module.ts<\/strong><\/p>\n<pre class=\"brush:perl\">import\u00a0{\u00a0BrowserModule\u00a0}\u00a0from\u00a0'@angular\/platform-browser';\r\nimport\u00a0{\u00a0NgModule\u00a0}\u00a0from\u00a0'@angular\/core';\r\nimport\u00a0{\u00a0FormsModule\u00a0}\u00a0from\u00a0'@angular\/forms';\r\nimport\u00a0{\u00a0HttpModule\u00a0}\u00a0from\u00a0'@angular\/http';\r\n\r\nimport\u00a0{\u00a0AppComponent\u00a0}\u00a0from\u00a0'.\/app.component';\r\nimport\u00a0{\u00a0MyComponentAComponent\u00a0}\u00a0from\u00a0'.\/my-component-a\/my-component-a.component';\r\n\r\n@NgModule({\r\n\u00a0\u00a0declarations:\u00a0[\r\n\u00a0\u00a0\u00a0\u00a0AppComponent,\r\n\u00a0\u00a0\u00a0\u00a0MyComponentAComponent\r\n\u00a0\u00a0],\r\n\u00a0\u00a0imports:\u00a0[\r\n\u00a0\u00a0\u00a0\u00a0BrowserModule,\r\n\u00a0\u00a0\u00a0\u00a0FormsModule,\r\n\u00a0\u00a0\u00a0\u00a0HttpModule\r\n\u00a0\u00a0],\r\n\u00a0\u00a0providers:\u00a0[],\r\n\u00a0\u00a0bootstrap:\u00a0[AppComponent]\r\n})\r\nexport\u00a0class\u00a0AppModule\u00a0{\u00a0}<\/pre>\n<h3>Create A Service<\/h3>\n<p>To create a new service, run the following;<\/p>\n<pre class=\"brush:perl\">ng g service my-service-a<\/pre>\n<p>This will generate a couple of files\u00a0under the <code>src\/app<\/code> directory:<\/p>\n<ul>\n<li><code>my-service-a.service.spec.ts<\/code>\n<ul>\n<li>unit test skeleton for this service<\/li>\n<\/ul>\n<\/li>\n<li><code>my-service-a.service.ts<\/code>\n<ul>\n<li>exports a class called <code>MyServiceAService<\/code><\/li>\n<li>generates empty constructor function<\/li>\n<li>decorates class with <code>@Injectable<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-service-my-service-a.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16961\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-service-my-service-a.png\" alt=\"\" width=\"326\" height=\"432\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-service-my-service-a.png 326w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-service-my-service-a-226x300.png 226w\" sizes=\"(max-width: 326px) 100vw, 326px\" \/><\/a><\/p>\n<p><strong>my-service-a.service.ts<\/strong><\/p>\n<pre class=\"brush:perl\">import\u00a0{\u00a0Injectable\u00a0}\u00a0from\u00a0'@angular\/core';\r\n\r\n@Injectable()\r\nexport\u00a0class\u00a0MyServiceAService\u00a0{\r\n\r\n\u00a0\u00a0constructor()\u00a0{\u00a0}\r\n\r\n}<\/pre>\n<h3>Create A Module<\/h3>\n<p>To create a new module, run the following:<\/p>\n<pre class=\"brush:perl\">ng g module my-module-a<\/pre>\n<p>This will do a couple things:<\/p>\n<ul>\n<li>create a directory <code>my-module-a<\/code> under <code>src\/app<\/code><\/li>\n<li>generate a file under that directory called <code>my-module-a.module.ts<\/code>\n<ul>\n<li>exports a class name <code>MyModuleAModule<\/code><\/li>\n<li>decorates that class with <code>@NgModule<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-module-my-module-a.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16962\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-module-my-module-a.png\" alt=\"\" width=\"399\" height=\"603\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-module-my-module-a.png 399w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-module-my-module-a-199x300.png 199w\" sizes=\"(max-width: 399px) 100vw, 399px\" \/><\/a><\/p>\n<p><strong>my-module-a.module.ts<\/strong><\/p>\n<pre class=\"brush:perl\">import\u00a0{\u00a0NgModule\u00a0}\u00a0from\u00a0'@angular\/core';\r\nimport\u00a0{\u00a0CommonModule\u00a0}\u00a0from\u00a0'@angular\/common';\r\n\r\n@NgModule({\r\n\u00a0\u00a0imports:\u00a0[\r\n\u00a0\u00a0\u00a0\u00a0CommonModule\r\n\u00a0\u00a0],\r\n\u00a0\u00a0declarations:\u00a0[]\r\n})\r\nexport\u00a0class\u00a0MyModuleAModule\u00a0{\u00a0}<\/pre>\n<h3>Create Component In A Module<\/h3>\n<p>Components can be added to generated module by changing to the module directory:<\/p>\n<pre class=\"brush:perl\">cd src\/app\/my-module-a<\/pre>\n<pre class=\"brush:perl\">ng g component my-subcomponent-a<\/pre>\n<p>or by prefixing the module name to the front of the new component name:<\/p>\n<pre class=\"brush:perl\">ng g component my-module-a\/my-subcomponent-a<\/pre>\n<p>This will do several things:<\/p>\n<ul>\n<li>create a directory <code>my-subcomponent-a<\/code> under the <code>src\/app\/my-module-a<\/code> directory<\/li>\n<li>generate all the component files under this directory (see <code>Create a component<\/code> section for description of files)<\/li>\n<li>add <code>MySubcomponentAComponent<\/code> to the <code>my-module-a.module.ts<\/code> file<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-component-my-module-a_my-component-a.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-16960\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-component-my-module-a_my-component-a.png\" alt=\"\" width=\"387\" height=\"620\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-component-my-module-a_my-component-a.png 387w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/04\/my-project-After-ng-g-component-my-module-a_my-component-a-187x300.png 187w\" sizes=\"(max-width: 387px) 100vw, 387px\" \/><\/a><\/p>\n<p><strong>my-module-a.module.ts<\/strong><\/p>\n<pre class=\"brush:perl\">import\u00a0{\u00a0NgModule\u00a0}\u00a0from\u00a0'@angular\/core';\r\nimport\u00a0{\u00a0CommonModule\u00a0}\u00a0from\u00a0'@angular\/common';\r\nimport\u00a0{\u00a0MySubcomponentAComponent\u00a0}\u00a0from\u00a0'.\/my-subcomponent-a\/my-subcomponent-a.component';\r\n\r\n@NgModule({\r\n\u00a0\u00a0imports:\u00a0[\r\n\u00a0\u00a0\u00a0\u00a0CommonModule\r\n\u00a0\u00a0],\r\n\u00a0\u00a0declarations:\u00a0[MySubcomponentAComponent]\r\n})\r\nexport\u00a0class\u00a0MyModuleAModule\u00a0{\u00a0}<\/pre>\n<p>This same pattern can be used for a class, interface, enum, service, or even another module.<\/p>\n<h2>Summary<\/h2>\n<p>As you can see, the Angular CLI has a lot to offer. It will create something that will get you up and running within a matter of minutes.\u00a0It will follow best practices as related to layout and naming conventions. It will allow you to add elements where they are needed and even do some of the plumbing for you.<\/p>\n<p>The CLI is not something that you have to use, but it is definitely helpful.\u00a0If you haven\u2019t used it before, it is worth checking out especially for someone getting their feet wet.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td><span class=\"reference\">Reference: <\/span><\/td>\n<td><a href=\"https:\/\/keyholesoftware.com\/2017\/04\/24\/getting-started-with-angular-cli-commands\/\">Getting Started With Angular CLI Commands<\/a> from our <a href=\"http:\/\/www.webcodegeeks.com\/join-us\/wcg\/\">WCG partner<\/a>\u00a0Brett Smith at the <a href=\"http:\/\/keyholesoftware.com\/\">Keyhole Software<\/a> blog.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I have been a developer for the past 20+ years and have used some of the \u2018big\u2019 languages (C, C++, C#, Java) throughout. I dabbled with JavaScript back before there were frameworks, when its use was to dynamically hide this control or disable that control. While it can still do those trivial tasks, JavaScript has &hellip;<\/p>\n","protected":false},"author":446,"featured_media":909,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-16953","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular-js"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Getting Started With Angular CLI Commands - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"I have been a developer for the past 20+ years and have used some of the \u2018big\u2019 languages (C, C++, C#, Java) throughout. I dabbled with JavaScript back\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting Started With Angular CLI Commands - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"I have been a developer for the past 20+ years and have used some of the \u2018big\u2019 languages (C, C++, C#, Java) throughout. I dabbled with JavaScript back\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-26T09:15:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Brett Smith\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brett Smith\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/\"},\"author\":{\"name\":\"Brett Smith\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/26cc95ffaf019443b25637fcd1c1139a\"},\"headline\":\"Getting Started With Angular CLI Commands\",\"datePublished\":\"2017-04-26T09:15:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/\"},\"wordCount\":1486,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"articleSection\":[\"Angular.js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/\",\"name\":\"Getting Started With Angular CLI Commands - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"datePublished\":\"2017-04-26T09:15:17+00:00\",\"description\":\"I have been a developer for the past 20+ years and have used some of the \u2018big\u2019 languages (C, C++, C#, Java) throughout. I dabbled with JavaScript back\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Angular.js\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Getting Started With Angular CLI Commands\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/26cc95ffaf019443b25637fcd1c1139a\",\"name\":\"Brett Smith\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/286e4dbcfa4b03c50534957db2e6f8d5c9fae68739298627ac1b56909f60a16a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/286e4dbcfa4b03c50534957db2e6f8d5c9fae68739298627ac1b56909f60a16a?s=96&d=mm&r=g\",\"caption\":\"Brett Smith\"},\"description\":\"He has been a software developer for the last 20+ years. He has used the Microsoft .NET technologies as well as Java across several industries (retail, education, pharmacy, document management, government). He has done desktop and web development as well as dabbling in some Android development. Recently he has been learning JavaScript and Angular.\",\"sameAs\":[\"https:\/\/keyholesoftware.com\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/brett-smith\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting Started With Angular CLI Commands - Web Code Geeks - 2026","description":"I have been a developer for the past 20+ years and have used some of the \u2018big\u2019 languages (C, C++, C#, Java) throughout. I dabbled with JavaScript back","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/","og_locale":"en_US","og_type":"article","og_title":"Getting Started With Angular CLI Commands - Web Code Geeks - 2026","og_description":"I have been a developer for the past 20+ years and have used some of the \u2018big\u2019 languages (C, C++, C#, Java) throughout. I dabbled with JavaScript back","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-04-26T09:15:17+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","type":"image\/jpeg"}],"author":"Brett Smith","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Brett Smith","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/"},"author":{"name":"Brett Smith","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/26cc95ffaf019443b25637fcd1c1139a"},"headline":"Getting Started With Angular CLI Commands","datePublished":"2017-04-26T09:15:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/"},"wordCount":1486,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","articleSection":["Angular.js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/","name":"Getting Started With Angular CLI Commands - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","datePublished":"2017-04-26T09:15:17+00:00","description":"I have been a developer for the past 20+ years and have used some of the \u2018big\u2019 languages (C, C++, C#, Java) throughout. I dabbled with JavaScript back","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/angularjs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/angular-js\/getting-started-angular-cli-commands\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Angular.js","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/angular-js\/"},{"@type":"ListItem","position":4,"name":"Getting Started With Angular CLI Commands"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/26cc95ffaf019443b25637fcd1c1139a","name":"Brett Smith","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/286e4dbcfa4b03c50534957db2e6f8d5c9fae68739298627ac1b56909f60a16a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/286e4dbcfa4b03c50534957db2e6f8d5c9fae68739298627ac1b56909f60a16a?s=96&d=mm&r=g","caption":"Brett Smith"},"description":"He has been a software developer for the last 20+ years. He has used the Microsoft .NET technologies as well as Java across several industries (retail, education, pharmacy, document management, government). He has done desktop and web development as well as dabbling in some Android development. Recently he has been learning JavaScript and Angular.","sameAs":["https:\/\/keyholesoftware.com"],"url":"https:\/\/www.webcodegeeks.com\/author\/brett-smith\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/446"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=16953"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/16953\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/909"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=16953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=16953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=16953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}