Questions tagged [angular2-cli]

124 questions
85
votes
14 answers

Angular 9 + CLI (TypeScript) - How to stop generating .spec.ts test files

I know it's kind of a bad practice, but bear with me: I'm using Angular-CLI, particularly ng g to generate all of my classes. However, I'm not interested in any *.spec.ts test files. I know that there are two flags (--inline-template,…
Mohamed Mo Kawsara
  • 4,400
  • 2
  • 27
  • 43
31
votes
5 answers

angular2-cli include custom fonts

I am trying to include some custom fonts in my project with no success. NOTE: I am using angular-cli: angular-cli@1.0.0-beta.21 I put the fonts in the folder src/assets/fonts/Roboto-Regular.tff I add in src/styles.css @font-face { font-family:…
mp3por
  • 1,796
  • 3
  • 23
  • 35
30
votes
5 answers

How to use jsPDF with angular 2

I got an Error: jsPDF is not defined , I am currenty using following code : import { Component, OnInit, Inject } from '@angular/core'; import 'jspdf'; declare let jsPDF; @Component({ .... providers: [ { provide: 'Window', useValue: window…
GsMalhotra
  • 1,837
  • 3
  • 14
  • 22
28
votes
8 answers

Invalid configuration object. Webpack has been initialised using a configuration

As of this morning, with Angular CLI 1.0.0-beta.14 I ng new try3 and ng serve and get the following error: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration…
Jan Nielsen
  • 10,892
  • 14
  • 65
  • 119
22
votes
2 answers

angular-cli for angular2 how to load environment variables

I am new to the angular-cli and want to load url's for my api service calls by env. E.g. local: http://127.0.0.1:5000 dev: http://123.123.123.123:80 prod: https://123.123.123.123:443 e.g. in environment.prod.ts I assume this: export const…
Tampa
  • 75,446
  • 119
  • 278
  • 425
21
votes
2 answers

Creating multiple bundles using angular-cli webpack

When i build the project using angular-cli, it bundles all project files into one big main bundle. I have used lazy routing in the application and i can navigate fine once application loads up. Is there a way in which main bundle is divided into…
Madhu Ranjan
  • 17,334
  • 7
  • 60
  • 69
20
votes
2 answers

Typescript: is not assignable to type error

I am new to using typescript with angular 2. I am using version 1 of angular 2-cli. When compiling, I get this error saying "is not assignable to type Assignment[]". I looked at the data types and it looks okay so far, but I am not sure what the…
LadyT
  • 649
  • 2
  • 12
  • 31
18
votes
16 answers

angular2-cli gives @multi styles error

I started using angular2-cli recently and created a new project. I wanted to use bootstrap in my project hence I installed bootstrap and then wanted to import the bootstrap css file like it is shown in the the angular2-cli guide here.…
codestruggle
  • 529
  • 3
  • 7
  • 17
18
votes
2 answers

Module not found: Error: Can't resolve 'hammerjs'

I updated my Angular 2 CLI project from 1.0.0-beta.11-webpack.2 to 1.0.0-beta.11-webpack.8 via ng init. My project uses Angular 2.0.0-rc.5 and Angular Material 2.0.0-alpha.7-4 but when run with ng serve I get the following error: ERROR in…
Jan Nielsen
  • 10,892
  • 14
  • 65
  • 119
15
votes
6 answers

How to serve an angular2 app in a node.js server

I'm building a web app using Angular2, to create the project I'm using Angular2 CLI webpack. Angular2 app uses other external packages also (Eg: Firebase). In addition to that, I need to create a REST API running on node.js How can I serve both of…
YohanK
  • 495
  • 1
  • 6
  • 12
14
votes
3 answers

Different proxy config based on environment in Angular 2 CLI

How can I declare 2 different proxy URLs for development and production environments in Angular 2 CLI project? For example, while in development mode, I would like to use { "/api/*": { "target": "http://localhost:3000", …
Tu Shams
  • 263
  • 1
  • 4
  • 15
13
votes
1 answer

Save the Angular CLI build logs to a file

I've checked here and there's no option that can be passed to the Angular CLI to save logs to a file. I've tried this: ng build |& tee output.txt The problem is that the resulting file is crashing my Atom editor and in Geany it's unreadable,…
manidos
  • 3,244
  • 4
  • 29
  • 65
12
votes
3 answers

Uncaught TypeError: this._input.charCodeAt is not a function

I created an Angular 2 project using Angular 2 CLI and used ng build --prod command and got no errors. When I upload the dist folder into my website, I get the following error when the app loads: Uncaught TypeError: this._input.charCodeAt is not a…
TheUnreal
  • 23,434
  • 46
  • 157
  • 277
10
votes
7 answers

How to include Underscore.js in angular2 project built using angular-cli

I want to include underscore.js inside angular2 project built using angular-cli. Till now I am unable to do so. I tried so far: 1- npm install underscore --save 2- tsd install underscore 3- script src="node_modules/underscore/underscore.js" ,…
raju
  • 6,448
  • 24
  • 80
  • 163
9
votes
2 answers

Is nested modules bad in Angular?

There is something I wonder about modules. I started Angular 2 a while ago, so i search too many topics but I couldn't find any satisfying answer yet. When we creating angular 2 application, using modules for sure. Also use nested modules of course.…
orhun.begendi
  • 937
  • 3
  • 16
  • 31
1
2 3
8 9