Angular 6



Prerequisite
- Node Js

Command
> npm -v //check nodejs version
> npm install -g @angular/cli  //install angular client
> ng new app --style=scss --routing   //create application, default style=css, add routing flag to create routing file\
> ng serve -o  //start server

File
1. index.html (specify app-root)
2. app.component.ts (descript app-root which contains ...)
   2.1 app.component.html
   2.2 app.component.scss

Add component
> ng generate component sidebar  OR
> ng g c posts
//create file necessary files e.g. html, scss, ts

Add service
> ng generate service data

Install angular animation
>npm install @angular/animation@latest --save

Build
>ng build
//To reduce the size
>ng build --prod

This will create /dist folder under project folder
However, you may have to change base href at index.html
e.g.  <base href="/ng7/dist/ng7/">

----------------------------------
Downgrade

to update node package manager. then run again
npm i npm@latest -g
ng --version

npm uninstall -g @angular/cli
npm cache clean --force

npm install -g @angular/cli@6.2.5
ng --version
----------------------------------

useful link
material.io
jsonplaceholder.typicode.com

****************************************************************
NVM
> nvm ls

> nvm use 10.13.0

****************************************************************
First time setup

https://linuxize.com/post/how-to-install-node-js-on-centos-7/
https://cli.angular.io/

****************************************************************

Set insensitive
Open terminal and edit /etc/mysql/my.cnf
sudo nano /etc/mysql/my.cnf
Underneath the [mysqld] section.add:
lower_case_table_names = 1
Restart mysql
sudo /etc/init.d/mysql restart
****************************************************************
Run unit Test

Runs unit tests in a project.
ng test <project> [options]

ng t <project> [options]
****************************************************************

Reference
https://www.youtube.com/watch?v=YFl2mCHdv24
https://coursetro.com/posts/code/154/Angular-6-Tutorial---Learn-Angular-6-in-this-Crash-Course
https://linuxize.com/post/how-to-install-node-js-on-centos-7/

Comments

Popular posts from this blog

M5Stack ESP32

Express connect to mysql

How to debug msbuild