Angular 6 library shared stylesheets

For global styles, I’ve answered it in this question. Update For ng-packgr versions 9.x and above Copying assest to output folder is now directly supported as explained in this page { “$schema”: “./node_modules/ng-packagr/package.schema.json”, “name”: “@my/library”, “version”: “1.0.0”, “ngPackage”: { “assets”: [ “CHANGELOG.md”, “./styles/**/*.theme.scss” ], “lib”: { … } } } So in your project you … Read more

how to enable gzip compression in angular cli for production build

Angular-cli team has removed the support for generating compress files (.gz). Github discussion url. We can use a gulp task for it. Install following npm modules: $npm install –save-dev gulp $npm install –save-dev gulp-gzip Create gulpfile.js. The file name has to be gulpfile.js not any other names. var gulp = require(‘gulp’); var gzip = require(‘gulp-gzip’); … Read more

How to get one file as output of angular cli

Angular CLI natively doesn’t support this. There are other solutions, including further processing with other tooling after Angular CLI finishes doing its thing, but this will hinder or remove the debugging capabilities Angular provides out-of-the-box. As the ng eject command is also being deprecated, the option to reconfigure webpack is not as attractive as it … Read more

Unable to get Angular CLI version, though all the requirements are installed?

Angular CLI requires a current, active LTS, or maintenance LTS version of Node (https://angular.io/guide/setup-local#nodejs). which version 11 isn’t. Node.JS 11 is no longer supported by the Node.Js team as after six months, odd-numbered releases (9, 11, etc.) become unsupported. More info: https://nodejs.org/en/about/releases Solution : Upgrade Node version to 12+

Command to Generate both a Routing Module & Component

There is no separate command to create routing.module file. But, that can be created while on the creation of the module: ng generate module [module-name] –routing or the shorthand version of the command: ng g m [module-name] –routing … will create the module and add the mappings/metadata linkings. I was searching about this a bit … Read more

How to proxy API requests to another server?

UPDATE 2022 The officially recommended approach is now the one documented here UPDATE 2017 Better documentation is now available and you can use both JSON and JavaScript based configurations: angular-cli documentation proxy sample https proxy configuration { “/angular”: { “target”: { “host”: “github.com”, “protocol”: “https:”, “port”: 443 }, “secure”: false, “changeOrigin”: true, “logLevel”: “info” } … Read more

Change the dist-folder path in angular-cli after ‘ng build’

The more current way of this is to update the outDir property in angular.json(called .angular-cli.json in old Angular CLI versions). The ng build command argument –output-path (or -op for short) is still supported also, which can be useful if you want multiple values, you can save them in your package.json as npm scripts. Beware: The … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)