Development Environment Setup
Node.js
Node.js is an open source server environment that runs on multiple platforms (Windows, Linux, Mac OS X, etc) and uses JavaScript on the server. It includes npm, which we need for installing packages/dependencies.
How do I get it? (Windows Users)
https://nodejs.org/en/download/
Download the installer and follow the installer instructions
Check Node and NPM versions
node -v
npm -vInstalling packages
npm install luxonDependencies vs DevDependencies
npm install jest --save-devGlobal vs Local Packages
Packages are installed locally (in current folder)
npm i @angular/cli -gGlobal packages are available from any folder and are installed in:
Windows
C:\Users{username}\AppData\Roaming\npm
Mac
/usr/local/lib/node_modules
Manually Adding dependencies
You can edit the package.json directly and add dependencies to the file. To install all the dependencies in package.json at once, run: npm install
Semantic Version
NPM uses semantic versioning to indicate major, minor, and patch releases
{
"@angular/core": "^8.1.2",
}Exact Version
8.1.2
Latest Patch
8.1
8.1.x
~8.1.2
Latest Minor
8
8.x
^8.1.2
Latest Major
*
Updating and removing packages
Remove packages:
npm uninstall @angular/coreFind outdated packages:
npm outdatedUpdate outdated packages:
npm update
Angular CLI
Command line interface for creating new Angular projects
Can generate Angular code for components, services, directives, modules, etc.
Standardizes build and deploy
Sets up unit and E2E testing
Makes new project setup a breeze
Creating new projects
ng new my-projectOptional Flags
--createApplication falseset to true by default, creates a new initial app in thesrcdirectory. When set to false, creates an empty workspace with no initial app. Ideal for App/Lib workspaces--dry-runshows an output of what would be created--minimalskips creating tests--prefix prefixthe prefix automatically added to generated component selectors (default is "app-")--routingadds routing to the project--skip-installskips the npm install process--skip-git falsesets project up for git and includes .gitignore file--verbosegenerates project with verbose output
Dev Web Server
The Angular CLI has a build in dev server that will serve your application.
Watches for changes and rebuilds your application
Refreshes browser with new changes
Can proxy requests to external APIs
Use
ng serveto build and serve your applicationUse
ng serve --sslto enable SSLUse
ng serve --live-reload falseto disable live reload
Proxy Setup
{
"/api": {
"target": "http://localhost:3000",
"secure": false
}
}"architect": {
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "your-application-name:build",
"proxyConfig": "src/proxy.conf.json"
},Code Editors
VS Code
Free
WebStorm
Subscription
Atom
Free
Sublime
One time cost
VIM
Free
Last updated