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
48
votes
4 answers

How do I build with watch enabled using angular-cli?

I don't want to use serve, I know it watches for changes, builds and serves. I want to build upon changes. According to "ng help", build takes parameter --watch ng build Builds your app and places it into the output path (dist/ by default). …
nurp
  • 1,239
  • 2
  • 14
  • 23
48
votes
14 answers

angular-cli how to add global styles?

I created a global style sheet using Sass and put it in the public/style/styles.scss. I only specify a background color. In the index, I added a link to it: The background color does not work on the…
Thibs
  • 8,058
  • 13
  • 54
  • 85
47
votes
10 answers

angular 9 library publish error "Trying to publish a package that has been compiled by Ivy"

I migrated my angular 8.x.x project to angular 9.x.x and when I try to publish my library, it fails with below error npm ERR! @candiman/website@9.0.0 prepublishOnly: node --eval "console.error('ERROR: Trying to publish a package that has been…
Aniruddha Das
  • 20,520
  • 23
  • 96
  • 132
47
votes
5 answers

Dynamically load HTML template in angular2

I have created a project using angular-cli which contains AppComponent as follows: import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export…
Partha Sarathi Ghosh
  • 10,936
  • 20
  • 59
  • 84
46
votes
14 answers

Angular/CLI -- auto reload doesn't happen

I recently started working with Angular/CLI tool, I'm facing a problem while executing the file, that is when I run ng serve then this command helps us in auto reloading the site when any changes are made in the source file but in my system it is…
Durga Abhist
  • 563
  • 1
  • 4
  • 6
46
votes
6 answers

Stripping all comments and console.logs with ng build --prod, possible?

I am using MEAN, Angular 2, Node/Express, Angular-CLI and ng build --prod to build my app and I have a travesty of commented out throwaway code and a billion debugging console.log statements throughout my app. Is there a way to have the build…
seanEd
  • 1,001
  • 1
  • 16
  • 29
45
votes
4 answers

Is there a way to extend configurations in angular.json?

While building my Angular 6 application, I need to specify 2 things at once: If it's production or development build The locale I'm using In my angular.json I have: "build": { ... "configurations": { "production": { …
Robert Kusznier
  • 6,471
  • 9
  • 50
  • 71
44
votes
5 answers

Is there a way to specify angular version with the ng new command

I am creating a new Angular project and would like all the Angular dependencies to be from the stable 7th version. However, it seems that while running the ng new app command the Angular always fetches the latest version. My package.json shows all…
Saurabh Tiwari
  • 4,632
  • 9
  • 42
  • 82
44
votes
6 answers

how can i run a specific angular spec test file in NX workspace?

is there any way to run an specific angular spec test file in Nx work space? Recently i moved my Angular 4 cli application into Nx work space. Previously i used fdescribe to achieve this functionality. So please suggest me if there is any…
Raj Kumar
  • 583
  • 2
  • 5
  • 9
44
votes
12 answers

Angular CLI gives me "TypeError: callbacks[i] is not a function" when I "ng serve"

I literally just made a fresh installation of the Angular CLI in order to try it out and I don't have a clue on what's causing the following error on the command line: PC:cobros Fran$ ng serve ** NG Live Development Server is listening on…
Franco Roura
  • 807
  • 8
  • 26
44
votes
4 answers

How to ignore/exclude some files/directory from linting in angular cli

Similar to this question I am running the following command to linting my angular2 typeScript code. ng lint It is proving all the linting error nicely. But I want my vendor folder (let say "src/app/quote/services/generated/**/*") should not get…
Partha Sarathi Ghosh
  • 10,936
  • 20
  • 59
  • 84
44
votes
9 answers

How to include git revision into angular-cli application?

I need to display git revision on my angular2 application's about page. The project is based on angular-cli. How can build be extended so git revision is put for example into environment.ts or other place accessible to application?
Vilmantas Baranauskas
  • 6,596
  • 3
  • 38
  • 50
44
votes
7 answers

GET http://localhost:4200/null 404 (Not Found) in angular2 with angular-cli

I'm working with angular2 project with angular-cli. Today I updated version of below to 2.4.1. "@angular/common": "~2.4.1", "@angular/compiler": "~2.4.1", "@angular/compiler-cli": "^2.4.1", "@angular/core": "~2.4.1", "@angular/forms":…
Mingyu Jeon
  • 1,755
  • 5
  • 23
  • 40
44
votes
5 answers

Make Angular working with restrictive Content Security Policy (CSP)

I cannot make base Angular2 (final) application works with the following restrictive CSP. default-src 'none'; script-src 'self'; style-src 'self'; font-src 'self'; img-src 'self' data:; connect-src 'self' There are one unsafe-eval error in lang.js…
Nicolas Henneaux
  • 11,507
  • 11
  • 57
  • 82
43
votes
5 answers

Angular CLI build using base-href and deploy-url to access assets on CDN

The background I'm using Angular CLI to build a project (with multiple apps). I want to publish the apps on separate sub-paths on my domain, like example.com/apps/app1/. If I set the --base-href parameter to /apps/app1/ it solves any issues…
david.emilsson
  • 2,313
  • 1
  • 20
  • 24