04 Frontend & Angular - lukes8/wiki-notes GitHub Wiki

How to switch from different nodeJS/angular version

tool NVM

npm install
check your global ng version - in case you have different then you will see some err msg like 
'Node.js version v12.11.0 detected.
The Angular CLI requires a minimum Node.js version of v18.13.'
Therefore you need to run ng cmd directly from angular CLI you installed for specific project (otherwise ng means globally)

ng serve -> uses global ng within angular CLI installed %USERPROFILE%\AppData\Roaming\npm\node_modules\@angular\cli\bin
node_modules/.bin/ng <ANY NG COMMAND> >> uses local ng 

How to install specific version of npm package

npm install [email protected] --save - installs package to local project

npm install -g @angular/[email protected] - installs specific version of angular CLI

npm rimraf

It is basically linux alternative for rm -rf command
npm install -g rimraf - package that can be used to simply remove big files for eg. node_modules

npm package manager, commands, What means tilda or caret before package version

npm root - location node_modules folder where all packages are downloaded for specific project
npm -g root - location global node_modules
npm ls - list of local node modules installed
npm ls -g - list of global packages 
npm list -g --dept=0 - list only base packages with no subfolders and their next dependencies

npm uses the tilde (~) and caret (^) to designate which patch and minor versions to use respectively. So if you see ~1.0.2 it means to install version 1.0.2 or the latest patch version such as 1.0.4. If you see ^1.0. 2 it means to install version 1.0. 2 or the latest minor or patch version such as 1.1.

Request method POST (typical use case is when we call http POST request then in Network we can see two request. OPTIONS and POST)
check whether the POST request is allowed to be sent

https://getbootstrap.com/docs/3.3/components/

string interpolation

<img src="{{ item.path }}">

property binding 
<img [src]="item.path">

To generate component without tests and within some folder

ng generate component <green> --skip-tests
ng generate component items/<green> --skip-tests

To generate component or whatever with no folder

ng g c test --flat
ng g module test --flat
ng g service test --flat
⚠️ **GitHub.com Fallback** ⚠️