Show Menu
Cheatography

Instal­lation

pre-re­qui­rement
NodeJS, npm, Angula­rCLI, IDE
update
ng update @angul­ar/cli @angul­ar/core
version check
node -v && npm -v && ng version

Project Setup

creating app
ng new my-app
app folder
cd my-app
run app
ng serve
run app custom
ng serve --host 0.0.0.0 –port 4205
 

Angular

 

app/ Structure

app.mo­dule.ts
explain the usage of the libraries. They are imported and saved into variables such as declar­ations, imports, providers, and bootstrap.
app.co­mpo­nen­t.html
html code for the app is in this file.
app.co­mpo­nen­t.s­pec.ts
contain unit tests for source component.
app.co­mpo­nent.ts
class for the component is defined. do the processing of the html structure in the .ts file.
app-ro­uti­ng.m­od­ule.ts
deal with the routing. connected with the main module, app.mo­dul­e.ts.

src/ Structure

app/
applic­ation folder that stores components of the applic­ation.
assets/
images, js files
enviro­nment/
details of whether the final file should be compiled in the production enviro­nment or the dev enviro­nment.
index.html
file which is displayed in the browser.
main.ts
importing the basic modules and setup.
polyfi­lls.ts
used for backward compat­ibi­lity.
test.ts
unit test cases for testing the project will be handled.
styles.css
style file required for the project.
favico­n.ico
site icon file
tsconf­ig.a­pp.json
config details that need to be used to run the applic­ation.
tsconf­ig.s­pe­c.json
helps maintain the details for testing.
typing­s.d.ts
manage the Typescript defini­tion.

Folder Structure

e2e/
end to end test folder. Mainly e2e is used for integr­ation testing and helps ensure the applic­ation works fine.
node_m­odules/
the npm package installed node_m­odules. Stores packages available.
src/
folder where work on the projec­t.app/ folder created during the project setup and holds all the required files required for the project.
angula­r.json
holds the project name, version of cli, etc.
.edito­rconfig
config file for the editor
.gitignore
file should be committed into the reposi­tory, in order to share the ignore rules with any other users that clone the reposi­tory.
packag­e.json
file tells which libraries will be installed into node_m­odules when you run npm install.
tsconf­ig.json
contains the compiler options required during compil­ation.
tslint.json
config file with rules to be considered while compiling.

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          AngularJS Cheat Sheet
          Angular 2 Forms Cheat Sheet