Questions tagged [angular-cli]

The Angular CLI is a command line interface for building, managing and deploying Angular (version 2+) applications.

The Angular CLI is a command line interface for building, managing and deploying Angular (version 2+) applications. It can be used to generate part of the application, serving in a local server, analysing code quality, etc. It is based on ember-cli project.

Installation

npm install -g @angular/cli

Usage

ng help

Generating and serving an Angular project via a development server

ng new PROJECT-NAME
cd PROJECT-NAME
ng serve

For more information, please visit the following links.

7329 questions
43
votes
7 answers

Hooking up express.js with Angular CLI in dev environment

I found a great tutorial that explains how to setup express.js with Angular CLI, but in this tutorial the angular app is compiled into a production dist folder: https://scotch.io/tutorials/mean-app-with-angular-2-and-the-angular-cli How do I…
etayluz
  • 15,920
  • 23
  • 106
  • 151
43
votes
4 answers

Where is the file angular-cli.json in the new @angular/cli version?

I'm new in angular2 and i have tried to create a project with cli, but when I try to change the css adding it in angular-cli.json, I have detected that this file is not created... Can I create manually or this file has been changed for another…
ioses
  • 997
  • 1
  • 8
  • 11
43
votes
10 answers

How to remove components created with Angular-CLI

I am working on angular2 for my new project, newly with this technology. I have set-up my project with angular CLI (Reference site https://github.com/angular/angular-cli). I have created 4 components using command ng generate component…
kishan kurivella
  • 589
  • 4
  • 7
  • 19
42
votes
1 answer

Angular 10 Stricter Settings --strict

In Angular 10 you can create a new project using ng new --strict Enabling this flag initializes your new project with a few new settings that improve maintainability, help you catch bugs ahead of time, and allow the CLI to perform advanced…
Doua Beri
  • 10,612
  • 18
  • 89
  • 138
42
votes
8 answers

How to generate your classes in a specific folder with Angula2 CLI?

I usually generate classes with the angular 2 cli with the following command: ng g class todo How can I tell the cli to generate the classes in a particular folder, for example a models folder. The documentation has an example where they generate a…
George Bora
  • 1,618
  • 6
  • 26
  • 45
41
votes
7 answers

Angular CLI ng command not found on Mac Os

I looked at the numerous posts on here regarding this issue and tried them but had no success resolving this. I am on MacOS and here is what I have done so far based on recommendations I have found here but I still get this error ~~ sudo npm…
pixel
  • 9,653
  • 16
  • 82
  • 149
41
votes
6 answers

How to decrease size of vendor.js in angular 2,4,6,7,8,9,10,11,12,13,14,15,16?

Angular CLI creates vendor.js and I don't know Why and What is the use of it?? Size of this file is about 3.2MB for a new app!! Does this file contains Angular 6 Javascript Source? Don't you think this is big file for loading on internet on low…
Mohamad Shiralizadeh
  • 8,329
  • 6
  • 58
  • 93
40
votes
3 answers

No provider for MatSnackBar error when trying to run "ng test"

So I'm trying to run "ng test" on my Angular 4 Angular CLI. I'm having many problems such as the UI not loading any helpful message if a test fails, but fortunately the console works. Anyways, this error is occuring saying I did not give MatSnackBar…
Sarah
  • 669
  • 2
  • 8
  • 21
40
votes
13 answers

Source File Not Found in Angular CLI project

Hi I have this folders in my project But When I run I get this error Any idea please? regards
kintela
  • 1,283
  • 1
  • 14
  • 32
40
votes
7 answers

Angular CLI: Change REST API URL on build

I want to remove my local server prefix from my REST API URLs (example, http://localhost:8080) when building for production (ng build --prod). I get that it's something to do with the environment file environment.prod.ts, but can't find any…
karthikaruna
  • 3,042
  • 7
  • 26
  • 37
40
votes
4 answers

How to debug Angular in prod server?

In the development environment I can debug with the Chrome source tab , but in the prod server I use the dist folder content after running ng build --prod. This folder contains compiled code so if there is a problem in the production I don't know…
David
  • 583
  • 2
  • 5
  • 9
40
votes
2 answers

tslint complaining "statements must be filtered with an if statement" when using switch

Lets say I have the following method: getErrorMessage(state: any, thingName?: string) { const thing: string = state.path || thingName; const messages: string[] = []; if (state.errors) { for (const errorName in state.errors) { …
MHOOS
  • 5,146
  • 11
  • 39
  • 74
40
votes
1 answer

Customise ng serve to proxy calls to /api?

I created a new application with ng CLI, works like a charm: ng new babysteps cd babysteps ng serve ng serve uses webpack to assemble the app. To fully test it, I need to serve /api... from my API mock server (specifically the POST requests). How…
stwissel
  • 20,110
  • 6
  • 54
  • 101
40
votes
4 answers

Angular-cli : Using ng lint

I'm aware the angular-cli uses codelyzer which uses lint.js When using the command: ng lint Can it automatically fix formatting? or will it only notify of formatting errors? ng lint --help outputs all help commands for the angular-cli.
Ben Winding
  • 10,208
  • 4
  • 80
  • 67
40
votes
4 answers

How to test an app created with Angular CLI ng serve from another device?

I have an app generated with Angular CLI from scratch. CLI version angular-cli: 1.0.0-beta.11-webpack.2 I am trying to test it from my smartphone but I get Connection refused. So, I run ng serve on my laptop and try to access the app: From laptop,…
Carlos Mermingas
  • 3,822
  • 2
  • 21
  • 40