angular-cli-v6

How do you debug an Angular 6 library

心已入冬 提交于 2019-12-03 02:12:08
I'm writing an Angular 6 Library and cannot figure out how to step into the typescript. I generated the app using: ng new mylibapp I then added the library using: ng g library @abc/cool-lib -p abc when I perform: ng build @abc/cool-lib it generates the code in the mylibapp/dist/abc/cool-lib folder How can I now debug this code and set breakpoints in the ts file located at mylibapp/projects/abc/cool-lib/src/lib Looking at the Angular CLI docs on libraries , it mentions the following: Some similar setups instead add the path to the source code directly inside tsconfig. This makes seeing changes

How do I turn off source maps for Angular 6 ng test?

一世执手 提交于 2019-12-03 01:33:34
I am trying to turn off sourcemaps for my tests in Angular 6. I know the sourcemaps switch has been removed, e.g., ng test --sourcemaps=false . I have tried modifying my tsconfig file: { "extends": "../tsconfig.json", "compilerOptions": { ... "sourceMap": false }, as referenced by the angular.json test->configuration block: "test": { ... "options": { ... "tsConfig": "src/tsconfig.spec.json", The source maps are still being generated. You can use CLI v6.0.8 and above --source-map=false CLI v6.x --sourceMap=false CLI v1.x --sourcemaps=false Angular CLI changing this param from version to version

How to Create a specific version of Angular Project using CLI?

北城以北 提交于 2019-11-30 11:29:27
My npm version is 5.5.1 and angular cli version is 6.2.1 . When I try to create a new project using the command ng new Project_name then it is creating the latest version of angular (in my case it is creating Angular version ^6.1.0 ). But I want Angular4 . My question is how to create this Angualr2/4/5 (specific version instead of the latest version)? I don't think changing the version value in package.json will help in my case because there are some differences in the older versions and the latest 6 version (like the name of one file has been changed from angular-cli.json to anguar.json and

Angular 6, should I put secret environment variables in environment.ts file?

坚强是说给别人听的谎言 提交于 2019-11-30 06:47:35
There are two sub-questions: Should I put secret environment variables in environment.ts file? The process variable shim is gone. If I use it, tsc will throw an error: Cannot find name 'process' . Here is my thing: About Q1: I don't think put secret environment variables in environment.ts file is correct. Because these files will be a push to source code management, like GitHub, gitlab, bitbucket. It's not safe. So I think secret environment variables should be passed through process.env , like process.env.ACCESS_TOKEN , or, if use docker-compose, should put the secret environment variables in

Angular 6, should I put secret environment variables in environment.ts file?

僤鯓⒐⒋嵵緔 提交于 2019-11-29 07:24:29
问题 There are two sub-questions: Should I put secret environment variables in environment.ts file? The process variable shim is gone. If I use it, tsc will throw an error: Cannot find name 'process' . Here is my thing: About Q1: I don't think put secret environment variables in environment.ts file is correct. Because these files will be a push to source code management, like GitHub, gitlab, bitbucket. It's not safe. So I think secret environment variables should be passed through process.env ,

ng new has stopped working after updating to Angular 6

99封情书 提交于 2019-11-29 07:22:12
Today, I updated my angular cli to the latest version and encountered an error that stops me from creating a new Angular project. Following is the error log that I get after executing ng new app-name : Error: Schematic "ng-new" not found in collection "@schematics/angular". at SchematicEngine.createSchematic (C:\Users\xyz\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\engine.js:155:23) at CollectionImpl.createSchematic (C:\Users\xyz\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\collection.js:12:29) at NodeWorkflow.execute (C:\Users

How to Create a specific version of Angular Project using CLI?

时间秒杀一切 提交于 2019-11-29 06:58:29
问题 My npm version is 5.5.1 and angular cli version is 6.2.1 . When I try to create a new project using the command ng new Project_name then it is creating the latest version of angular (in my case it is creating Angular version ^6.1.0 ). But I want Angular4 . My question is how to create this Angualr2/4/5 (specific version instead of the latest version)? I don't think changing the version value in package.json will help in my case because there are some differences in the older versions and the

angular 6 - best practice of sharing common code between projects

江枫思渺然 提交于 2019-11-27 18:38:29
问题 How to share code between projects ? I have two apps created using: ng generate application app1 ng generate application app2 I want projects/app1/src/app.module.ts to import a module from projects/app2/src/shared/common.module.ts What is the best practice for this without creating a 3rd project called common or something ? Create a projects/common or just have a folder called common and plate TypeScript files here and import them. 回答1: Use library projects! ng generate library common This

@types/googlemaps/index.d.ts' is not a module

房东的猫 提交于 2019-11-27 18:17:55
I want to use the Google Maps API with my Angular project, so I used these two commands to install npm packages: npm install @agm/core --save-dev npm install @types/googlemaps --save-dev I added this line to my component: import {} from "@types/googlemaps"; But I see these 2 errors in VS Code: [ts] File 'h:/Angular Projects/Breakfast/client/breakfast/node_modules/@types/googlemaps/index.d.ts' is not a module. [ts] Cannot import type declaration files. Consider importing 'googlemaps' instead of '@types/googlemaps'. I added these lines "types": ["googlemaps"] "moduleResolution": "node" to

@types/googlemaps/index.d.ts' is not a module

ⅰ亾dé卋堺 提交于 2019-11-26 22:40:41
问题 I want to use the Google Maps API with my Angular project, so I used these two commands to install npm packages: npm install @agm/core --save-dev npm install @types/googlemaps --save-dev I added this line to my component: import {} from "@types/googlemaps"; But I see these 2 errors in VS Code: [ts] File 'h:/Angular Projects/Breakfast/client/breakfast/node_modules/@types/googlemaps/index.d.ts' is not a module. [ts] Cannot import type declaration files. Consider importing 'googlemaps' instead