angular2-cli

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

為{幸葍}努か 提交于 2019-11-27 12:45:45
问题 I KNOW IT'S KIND OF A BAD PRACTICE, but pair with me: I'm using Angular-CLI and particularly ng g to generate all of my classes, however, I'm not interested in any test file *.spec.ts and I know that there are two flags ( --inline-template , --inline-style ) to handle inline CSS and HTML instead of separated files. and for spec the default flag is set to true --spec So for each run, yes, I can do so ng g c foo --it --is --spec=false But How to disable the creation of test files globally? is

How to use jsPDF with angular 2

此生再无相见时 提交于 2019-11-26 17:58:32
问题 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 } ] }) export class GenratePdfComponent implements OnInit { constructor( @Inject('Window') private window: Window, ) { } download() { var doc = jsPDF(); doc.text(20, 20, 'Hello world!'); doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');