Angular Commands - Read Me
## Development server
Run <<ng serve>> for a dev server. Navigate to <<http://localhost:4200/>>.
The app will automatically reload if you change any of the source files.
## Code scaffolding
Run <<ng generate component component-name>> to generate a new component.
You can also use <<ng generate directive|pipe|service|class|guard|interface|enum|module>>
## Build
Run <<ng build>> to build the project. The build artifacts will be stored in the <<dist/>> directory. Use the <<-prod>> flag for a production build.
## Running unit tests
Run <<ng test>> to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run <<ng e2e>> to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Run <<ng serve>> for a dev server. Navigate to <<http://localhost:4200/>>.
The app will automatically reload if you change any of the source files.
## Code scaffolding
Run <<ng generate component component-name>> to generate a new component.
You can also use <<ng generate directive|pipe|service|class|guard|interface|enum|module>>
## Build
Run <<ng build>> to build the project. The build artifacts will be stored in the <<dist/>> directory. Use the <<-prod>> flag for a production build.
## Running unit tests
Run <<ng test>> to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run <<ng e2e>> to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Update You Angular CLI globally:
npm install -g @angular/cli
npm install -g @angular/cli@10.2.1
--GLOBAL PATH
C:\Users\<<Your LocalUserName>>\AppData\Roaming\npm\node_modules
---tslint to install globally -- DEPRECATED
npm install -g tslint
---typescript to install globally
npm install -g typescript
----Run the CLI command ng new and provide the name my-app, as shown here:
ng new my-app
---Change directory to navigate to new app folder
cd my-app
---Run the application -> It will open application in localhost:4200 default port
ng serve --open
--Create component
ng generate component about-us
ng generate component faqs
ng generate component contact-us
Short naming convention for create component
It will skip auto creating test spec file
ng g c about-us --skipTests=true
--Add Material theme
ng add @angular/material
npm uninstall @angular/material
--Add Bootstrap theme to your project
npm install bootstrap
ng add @ng-bootstrap/ng-bootstrap
--Babel Transpiler
npm install --save-dev @babel/cli @babel/preset-env
npm uninstall --save-dev @babel/cli @babel/preset-env
Q1: If you get below Error message then use below command to resolve the issue.
disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ ng generate component security
+ ~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
>>
SOLUTION: Open PowerShell & run below command.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
start-job { Set-ExecutionPolicy RemoteSigned } -RunAs32 | wait-job | Receive-Job
If you have proxy setting which won't allow you to download the node modules then try to run below commands
npm config set proxy http://proxy.test.com:9090
Here proxy.test.com would be your organization port and host name
npm install -global @angular/cli@wished.version.here
npm unistall -global @angular/cli
npm config get registry
npm cache clean --force
npm config list
npm config rm https-proxy
npm config rm proxy
ng --version
--------------
NODE JS
--------------
Install expressJs
npm install express
Comments
Post a Comment