angular cli 入门

# npm
# %AppData%\npm
# %AppData%\npm-cache
$ node -v
$ npm -vcss

# 淘宝镜像
# C:\Program Files\nodejs\node_modules\npm\npmrc
prefix=${APPDATA}\npm
registry=https://registry.npm.taobao.orgnode

$ npm install -g cnpm --registry=https://registry.npm.taobao.org
$ cnpm sync connectnpm

# angular cli
$ npm install -g @angular/cli
$ ng -vjson

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

# tools
$ npm install -g http-server
$ npm install -g json-serverui

$ npm install -g jslint
$ npm install -g tslint
$ npm install -g eslinteslint

# angular app
$ rmdir /s /q node_modules
$ ng new latitude-ng --skip-install --skip-tests --routing --style=scss --prefix=app
$ cd latitude-ng
$ npm installcomponent

# component
$ ng g c latitude-component
$ ng g component latitude-component
$ ng g component components/footerserver

# directive
$ ng g d latitude-directive
$ ng g directive latitude-directiveip

# pipe
$ ng g p latitude-pipe
$ ng g pipe latitude-pipe

# service
$ ng g s latitude-service
$ ng g service latitude-service

# class
$ ng g cl latitude-class
$ ng g class latitude-class

# guard
$ ng g guard latitude-guard

# interface
$ ng g i latitude-interface
$ ng g interface latitude-interface

# enum
$ ng g e latitude-enum
$ ng g enum latitude-enum

# module
$ ng g m my-module
$ ng g module my-module

$ ng serve --port 4200 --open
$ ng build --prod
$ ng test

<!-- ngIf -->
<p *ngIf="list.length > 3">
  这是 ngIF 判断是否显示
</p>
<p template="ngIf list.length > 3">
  这是 ngIF 判断是否显示
</p>

<!-- ngFor --> <ul>   <li *ngFor="let item of list;let i = index;">     {{item}} --{{i}}   </li> </ul> <ul>   <li template="ngFor let item of list">     {{item}}   </li> </ul>

相关文章
相关标签/搜索