Angular-CLI proxy to backend doesn’t work

Could you try with this one: { “/api”: { “target”: “http://url.com”, “secure”: false, “pathRewrite”: {“^/api” : “”} } } It works for me, ** NG Live Development Server is running on http://localhost:4200. ** 10% building modules 3/3 modules 0 active[HPM] Proxy created: /api -> http://ec2-xx-xx-xx-xx.ap-south-1.compute.amazonaws.com [HPM] Proxy rewrite rule created: “^/api” ~> “”

Cannot find name ‘require’ after upgrading to Angular4

The problem (as outlined in typescript getting error TS2304: cannot find name ‘ require’) is that the type definitions for node are not installed. With a projected genned with @angular/cli 1.x, the specific steps should be: Step 1: Install @types/node with either of the following: – npm install –save @types/node – yarn add @types/node -D … Read more

how to format date in Component of angular 5

There is equally formatDate const format=”dd/MM/yyyy”; const myDate=”2019-06-29″; const locale=”en-US”; const formattedDate = formatDate(myDate, format, locale); According to the API it takes as param either a date string, a Date object, or a timestamp. Gotcha: Out of the box, only en-US is supported. If you need to add another locale, you need to add it … Read more

How to add font-awesome to Angular 2 + CLI project

After Angular 2.0 final release, the structure of the Angular2 CLI project has been changed — you don’t need any vendor files, no system.js — only webpack. So you do: npm install font-awesome –save In the angular-cli.json file locate the styles[] array and add font-awesome references directory here, like below: “apps”: [ { “root”: “src”, … Read more

How do I support Internet Explorer in an Angular 8 application?

According to this issue reply You need to follow the following steps Create a new tsconfig tsconfig.es5.json next to tsconfig.json with the below contents { “extends”: “./tsconfig.json”, “compilerOptions”: { “target”: “es5” } } In angular.json Under projects:yourAppName:architect:build:configurations, add “es5”: { “tsConfig”: “./tsconfig.es5.json” } and projects:yourAppName:architect:serve:configurations add “es5”: { “browserTarget”: “yourAppName:build:es5” } Remember to change yourAppName … Read more

Is there a compatibility list for Angular / Angular-CLI and Node.js?

|Angular CLI| Angular | NodeJS |TypeScript | RxJS Version | |———–|——————–|—————————— |———–|—————————————–| |- |2.x |6.0.x or later minor |2.0.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x | |1.0.6 |4.x |6.9.x or later minor |2.2.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x | |1.1.3 |4.x |6.9.x or later minor |2.3.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x | |1.2.7 |4.x |6.9.x or later minor |2.3.x |5.0.x/5.1.x/5.2.x/5.3.x/5.4.x/5.5.x | |1.3.2 |4.2.x or later minor|6.9.x or later … Read more

Angular CLI SASS options

Angular CLI version 9 (used to create Angular 9 projects) now picks up style from schematics instead of styleext. Use the command like this: ng config schematics.@schematics/angular:component.style scssand the resulting angular.json shall look like this “schematics”: { “@schematics/angular:component”: { “style”: “scss” } } Other possible solutions & explanations: To create a new project with angular … Read more

Angular Cli Webpack, How to add or bundle external js files?

Last tested using angular-cli 11.x.x with Angular 11.x.x This can be accomplished using scripts:[] in angular.json. { “project”: { “version”: “1.0.0”, “name”: “my-project” }, “apps”: [ { “root”: “src”, “outDir”: “dist”, “assets”: [“assets”], “index”: “index.html”, “main”: “main.ts”, “polyfills”: “polyfills.ts”, “test”: “test.ts”, “tsconfig”: “tsconfig.json”, “prefix”: “app”, “mobile”: false, “styles”: [ “styles.css” ], “scripts”: [ “../node_modules/jquery/dist/jquery.js” ], … Read more

How to add bootstrap to an angular-cli project

IMPORTANT UPDATE: ng2-bootstrap is now replaced by ngx-bootstrap ngx-bootstrap supports both Angular 3 and 4. Update : 1.0.0-beta.11-webpack or above versions First of all check your angular-cli version with the following command in the terminal: ng -v If your angular-cli version is greater than 1.0.0-beta.11-webpack, then you should follow these steps: Install ngx-bootstrap and bootstrap: … Read more