Friday, 25 August 2017

All command related angular 2 or 4

All command related angular 2 or 4:

node JS latest version=>  https://nodejs.org/en/download/current/
Angular js 2 or 4 CLI=>  https://cli.angular.io/
Angular js 2 or 4 API=>  https://angular.io/api





CMD Description
1 npm install –g @angular/cli
1. For install all dependences of angularJS 2 or 4 in your System.


2 ng new my-project-name
1. Default applications are created in a directory of the same name, with an
Initialized Angular application.
2. Scaffold and maintain Angular applications.
3 cd my-project-name 1. Go same location where you create project.
4 ng serve
or



ng serve --host 0.0.0.0 --port 4201
1. Ng serve builds the application and starts a web server.
2. Build using Ahead of Time compilation (AOT).
3. Default port value: 4200
4. Enable and define the file watching poll time period (milliseconds).
5. Start web pack dev server.
6. Change Port number of application.
5 ng generate [name] 1. Ng generates the specified blueprint (module, component, service, class, interface, directive, enum, guard, pipe, service).
6 ng –g controller [name] 1. This is also working same as above g stand for generate.
7 ng test
1. Compiles the application into an output directory.
2. Tests will execute after a build is executed via Karma, and it will automatically watch your files for changes
8 ng e2e 1. serves the application and runs end-to-end tests
9 ng build 1. Compiles the application into an output directory.
10 *ngFor
<li *ngFor="let user of list | async as users; index as i; first as isFirst"></li>
1. index: number: The index of the current item in the iterable.
2. first: boolean: True when the item is the first item in the iterable.
3. last: boolean: True when the item is the last item in the iterable.
4. even: boolean: True when the item has an even index in the iterable.
5. odd: boolean: True when the item has an odd index in the iterable.
11 *ngIf
ngIF=> <div *ngIf=”true”></div>
ngIF and else=> <div *ngIf=”true; else elseBlock ”></div>
12 [ngPlural]
Use as a switch statement.
<some-element [ngPlural]="value">
<ng-template ngPluralCase="=0">...</ng-template>
<ng-template ngPluralCase="other">...</ng-template>
</some-element>
13 [ngStyle] <H [ngStyle]="{'font-style': styleExp}">...</h>
14 [ngSwitch]
1. <div [ngSwitch]="expression"> <span ngSwitchCase="matchExp ">...</span></div>
2. <span *ngSwitchDefault>...</span>
15 async
1. The async pipe subscribes to an Observable or Promise and returns the latest value it has emitted.
2. <div><code>observable|async</code>: Time: {{ time | async }}</div>


16 date                  
<p>Today is {{today | date}}</p>
<p>Or if you prefer, {{today | date:'fullDate'}}</p>
<p>The time is {{today | date:'jmZ'}}</p>
17 JSON <pre>{{object | json}}</pre>
18 lowercase <p>In lowercase: <pre>'{{value | lowercase}}'</pre>


uppercase <p>In lowercase: <pre>'{{value | uppercase}}'</pre>
19 currency
"number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]"
<p>A: {{a | currency:'USD':false}}</p>
<p>B: {{b | currency:'USD':true:'4.2-2'}}</p>
20 number <p>e (3.1-5): {{e | number:'3.1-5'}}</p>
21 percent
<p>A: {{a | percent}}</p>
<p>B: {{b | percent:'4.3-5'}}</p>
22 slice
<li *ngFor="let i of collection | slice:1:3">{{i}}</li>
<li string | slice:1:3">{{i}}</li>
23 titlecasepipe <li string | titlecasepipe "></li>


24 .  ng build    =>     using for build application and bundling all type script.

25.   npm uninstall -g angular-cli  => uninstall angular .

26.   npm uninstall --save-dev angular-cli => uninstall but save your development work.

27. update Angular CLI to a new version, you must update both the global package and your project's local package.

      A. Global package:
                            npm uninstall -g @angular/cli
                            npm cache clean
                            npm install -g @angular/cli@latest

      B. Local project package:
                          rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command                           Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
                          npm install --save-dev @angular/cli@latest
                          npm install

28. ng serve --host 0.0.0.0 --port 4201  => Change Port number of application.

29. npm install -g nodemon =>    Nodemon is a utility that will monitor for any changes in your                                                                 source and automatically restart your server

No comments:

Post a Comment