angular-cli

@angular-builders - ignore certain script during in the optimisation phase

风格不统一 提交于 2020-01-05 04:11:02
问题 I need to make Angular ignore a certain js file during the optimization phase (so that it's not optimized/minified) in prod build. For this purpose the @angular-builders package seemed like a viable solution. I setup the angular.json config as follows: "architect": { "build": { "builder": "@angular-builders/custom-webpack:browser", "options": { "customWebpackConfig": { "path": "./extended-webpack.config.js", "mergeStrategies": { "optimization": "replace" } }, The build configurations are as

How to debug an application in Angular2 using angular-cli?

一笑奈何 提交于 2020-01-04 05:43:09
问题 Does anyone know if it's possible to debug an application using angular-cli with the command line ng serve in WebStorm?. I tried the solution posted in this url: How to debug angular 2 app using angular-cli webpack? But it didn't work for me and I decided to make a new answer, because it's a little weird that angular-cli doesn't have some tools to do this. 回答1: Here is my run configuration for Angular2 (2.3) project built with angular-cli (1.0.0-beta.21) Some things to check: Do you have

ng: command not found

笑着哭i 提交于 2020-01-04 02:50:47
问题 I am trying to run ng build in my project folder, but I get the following response: bash: ng: command not found What am I missing? Does it have to do with admin privileges, my path/profile, or something I need to install globally? This is my package.json : { "name": "meanauthapp", "version": "1.0.0", "description": "MEAN stack authentication app", "main": "app.js", "scripts": { "start": "node app" }, "dependencies": { "express": "4.16.2", "mongoose": "4.13.6", "bcryptjs": "2.4.3", "cors": "2

npm install killed without a good error

淺唱寂寞╮ 提交于 2020-01-04 02:26:28
问题 When I run ng new new-app to create an angular2 app, angular-cli creates the files and runs npm install The npm install is then killed without any error message. Almost all answers online pointed to a possible problem with running out of memory, so I upgraded my VPS from 512MB to 1GB of RAM. It seems unlikely to me that a fresh Ubuntu 16.04 with 1GB RAM cannot npm install a standard angular2 app. Is there anything else I can try other than adding swap or ram? Thanks! 回答1: Adding RAM to the

Angular serve library

删除回忆录丶 提交于 2020-01-03 20:10:48
问题 In latest versions of Angular cli, we can use ng g library lib-name command to create library. As mentioned in the Angular docs : ng serve <project> And: <project> The name of the project to build. Can be an app or a library. So, we can serve library . But when I serve I get the following errors: Project 'ngx-tab-component' does not support the 'serve' target. Error: Project 'ngx-tab-component' does not support the 'serve' target. at ServeCommand.initialize (C:\Users\vahidnajafi\angular\ngx

Error when loading a Angular app with AOT build on Amazon S3

自古美人都是妖i 提交于 2020-01-03 17:04:17
问题 I have hosted my Angular App which is compiled using AOT compiler on Amazon S3. However, when I try to load the app it gives me the following error The app runs perfectly well with ng serve --aot but the same error will come up if I serve the distribution on python http-server locally. Update: I have tried different workarounds and ways to try to get it working. But i haven't been able to fix it. I suspect that the error throws when trying to do a production build with AOT compiler. When

How can I rewrite the path in a reverse proxy with Angular-CLI?

人盡茶涼 提交于 2020-01-03 08:44:11
问题 I have set up the reverse proxy with the angular2 CLI like the following: { "/api/customer/*": { "target": "http://localhost:9010", "secure": false } } My problem is that the remote API is exposing a service on the path /customer, but the request that is sent by the reverse proxy is on /api/customer. Is there a way to remove the /api from the request that is sent by the reverse proxy? (Don't answer with "just remove the /api from your http request", because I have an angular route on

ERROR in ** is not an NgModule

早过忘川 提交于 2020-01-03 07:31:13
问题 I have this NgModule: @NgModule({ imports: [ CommonModule ], exports: [ SP21LoadingBar ], declarations: [SP21LoadingBar] }) export class SP21LoadingBarModule { } The Cli ist telling me ERROR in SP21LoadingBarModule is not an NgModule Please notice: If i take the code and put it into my project it works fine. But as soon as I take the module (and component) out of my project and put it into a npm package, i get that error. Angular is used in 2.3.1, Angular CLI 1.0.0-beta.24, Typescript 2.0.10

How to change the values of Boolean in between two components in angular 4

﹥>﹥吖頭↗ 提交于 2020-01-03 05:09:07
问题 I am trying to hide some Content in in the UI using *ngif of angular4 its not working properly. can anybody help me on this. its value is not changing in the other component. Navbar Template: <div class="collapse navbar-collapse" id="navbarTogglerDemo02"> <ul class="navbar-nav ml-auto mt-2 mt-md-0"> <li class="nav-item active"> <a class="nav-link" href="#">Dashboard</a> </li> <div *ngIf="saveSpinner==true" class="dropdown notificatio-dropdown"> <li> <a href="#" class="dropdown-toggle" data

Reactive formbuilder doesn't accept form control name from function's parameter

南楼画角 提交于 2020-01-03 01:34:28
问题 I have a function to create form group like, public initFormGroup(control_name) { console.log(control_name) // can log control_name return this._formBuilder.group({ control_name: '' // This control_name is not same as its function property }); } I am passing the control name through the function parameter but the control_name inside this._formBuilder.group is not as that i passed The result finally looked like , "children": [ { "control_name": "" }, { "control_name": "" } ] The desired output