angular-cli-v6

Bootstrap 4.1.1 Navbar not working with Angular 6

喜欢而已 提交于 2019-12-05 11:42:42
I have been trying to work on Navbar with collapse menu and dropdown link using Bootstrap 4.1.1 and Angular 6 but somehow Navbar is not working at all. I can see elements correctly but they don't function as intended. I installed Bootstrap via Angular CLI using 'ng install bootstrap --save' and Bootstrap dependencies: 'ng install jquery --save' and 'ng install popper.js --save' I also included Bootstrap, jquery and popper.js in package.json and angular.json package.json: "dependencies": { "@angular/animations": "^6.0.0", "@angular/common": "^6.0.0", "@angular/compiler": "^6.0.0", "@angular

[Angular-CLI-6]Could not determine single project for 'Serve' target

有些话、适合烂在心里 提交于 2019-12-05 07:20:54
I have updated my angular-cli with the help of ng update @angular/cli command. After that, I have got an error as Could not determine single project for 'server' target with following error trace. Could not determine a single project for the 'serve' target. Error: Could not determine a single project for the 'serve' target. at ServeCommand.getProjectNamesByTarget (E:\Angular\Projects\projectName\node_modules\@angular\cli\models\architect-command.js:175:19) at ServeCommand.<anonymous> (E:\Angular\Projects\projectName\node_modules\@angular\cli\models\architect-command.js:128:51) at Generator

ng build --prod does NOT minify / uglify / remove comments since Angular CLI 6

旧街凉风 提交于 2019-12-04 11:29:49
问题 Since I've upgraded my Angular app to use Angular CLI version 6.x , compiling it for production (using ng build --prod , as usual) does not produce minified js. This result in very big vendor.js size (in my case is almost 10 MB). If I open the resulting vendor.js file, I can clearly see that the code is not minified and the comments are not removed. 回答1: The issue is in angular.json file. Under the key projects.MY_PROJECT_NAME.architect.build.configurations.production , I was missing all the

Angular : Unable to pass API url in SignalR HubConnection

只谈情不闲聊 提交于 2019-12-04 09:34:16
I have developed a project in Angular6. There is a requirement to develop section for live chat. For that I am using SignalR in my asp.net core Web Apiproject. Now I want to use this Web Api reference in my Angular project. I am using this link. But while providing the Web Api url in App.Component.ts, I am getting below error : Constructor of class 'HubConnection' is private and only accessible within the class declaration. App Component.ts : import { HubConnection } from '@aspnet/signalr'; import { Message } from 'primeng/api'; export class AppComponent implements OnInit { public

ng-cli 6 and font awesome icons not working

这一生的挚爱 提交于 2019-12-04 08:25:31
I am using font-awesome 4.70, angular 6.0.8, and cli 6.0.8(full versioning below) I am trying to replace our existing webpack process with the cli's "ng build". I have run into an issue with font awesome's icons not showing up. I have seen similar issues in the past with older versions but I havent found a solution yet. I have the fonts hooked up in my assets assets:[ "./node_modules/font-awesome/fonts", //other assets ] And I am including the css in the styles portion of my angula.json styles:[ "./node_modules/font-awesome/css/font-awesome.css", //other styles ] I am not using "ng serve", I

Working with component css files in workspaces in chrome with angular cli 6 project

百般思念 提交于 2019-12-04 08:24:16
I'm trying to use Google Chrome workspaces with CSS persistent editing in an Angular 6/7 CLI project. When adding "extractCSS:true" in angular.json configuration and using "--source-map=true" flag I can see the CSS file in the "sources" and "elements" tabs in Chrome, and I can map it to the online CSS file, but when changing the style in the "elements" panel the change is not persistent and is not saved to the file. Is it possible to edit the component CSS files from within Chrome dev tools with workspaces (without ejecting the app) ? In the following GIF you can see that although the little

How do you debug an Angular 6 library

十年热恋 提交于 2019-12-03 12:45:21
问题 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 回答1: Looking at the Angular CLI docs on libraries, it mentions the following: Some

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

允我心安 提交于 2019-12-03 11:17:16
问题 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. 回答1: You can use CLI v6.0.8 and above --source-map=false

AngularCLI and Angular Material (schematics) error: Collection “@angular/material” cannot be resolved

偶尔善良 提交于 2019-12-03 10:12:05
I am trying to use the Angular schemats that are shown on this page. When I try to use this following command in the terminal at the root of the project ng generate @angular/material:material-nav --name name-of-new-nav , I get the following error in red, Collection "@angular/material" cannot be resolved. Error: Collection "@angular/material" cannot be resolved. at NodeModulesEngineHost._resolveCollectionPath (/Users/jeremypeters/MEGA/development/learning/angular/material-learn/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:88:15) at NodeModulesEngineHost

Angular 6 library shared stylesheets

六眼飞鱼酱① 提交于 2019-12-03 05:43:51
问题 How can you setup a index.scss and import global stylesheets for variables, mixins, etc, to an angular 6 library? Angular CLI generates a lib with a root component & component scss, but the styles added or imported to the root component are not available to children components. Which makes sense by default to encapsulate the styles, but I just can't find any information or examples on how to set this up yet. The angular.json "styles": [...] paths that can be used for this with "projectType":