angular cli Readme.md文件内容 - Christian-Yang/Translate-and-save GitHub Wiki
Angular CLI
CLI for Angular applications based on the ember-cli project.
基于ember-cli项目的Angular应用程序的CLI。
Note
注意
The CLI is now in Release Candidate (RC). If you are updating from a beta version, check out our RC Update Guide.
CLI现在处于Release Candidate(RC)。 如果您正在从测试版更新,请查看我们的RC更新指南。(就是说不要在使用测试beta版本了,至少用使用RC版本)
If you wish to collaborate, check out our issue list.
如果您希望协作,请查看我们的问题列表。
Before submitting new issues, have a look at issues marked with the type: faq label.
在提交新问题之前,请查看标记有类型:faq标签的问题(issues)。
Prerequisites
先决条件
Both the CLI and generated project have dependencies that require Node 6.9.0 or higher, together with NPM 3 or higher.
CLI和生成的项目都具有需要node 6.9.0或更高版本以及NPM 3或更高版本的依赖关系。
Table of Contents:目录
Installation:安装
Usage:用法
Generating a New Project:生成新项目
Generating Components, Directives, Pipes and Services:生成组件,指令,管道和服务
Updating Angular CLI:更新Angular CLI
Development Hints for hacking on Angular CLI:开发提示在Angular CLI上的黑客
Documentation:文档
License:执照
Installation:安装
BEFORE YOU INSTALL: please read the prerequisites
在安装之前:请阅读前提条件
npm install -g @angular/cli
Usage:用法
ng help
Generating and serving an Angular project via a development server
通过开发服务器生成和提供Angular项目
ng new PROJECT_NAME :例如 ng new Uniportal
cd PROJECT_NAME
ng serve
Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
导航到http://localhost:4200/。 如果您更改任何源文件,应用程序将自动重新加载。
You can configure the default HTTP host and port used by the development server with two command-line options :
ng serve --host 0.0.0.0 --port 4201
您可以使用两个命令行选项配置开发服务器使用的默认HTTP主机和端口:(就是说可以同时调试两个程序,在不同的端口)
ng serve --host 0.0.0.0 --port 4201
Generating Components, Directives, Pipes and Services
You can use the ng generate (or just ng g) command to generate Angular components:
生成组件,指令,管道和服务
您可以使用ng generate(或just ng g)命令生成Angular组件
ng generate component my-new-component
ng g component my-new-component # using the alias
ng generate component my-new-component
ng g component my-new-component#使用别名
'# components support relative path generation
'# if in the directory src/app/feature/ and you run
ng g component new-cmp
'#组件支持相对路径生成
'#如果在目录src/app/feature/中运行
ng g component new-cmp
'# your component will be generated in src/app/feature/new-cmp
'# but if you were to run
ng g component ../newer-cmp
'# your component will be generated in src/app/newer-cmp
'#你的组件将在src/app/feature/new-cmp中生成
'#但是如果你要run
ng g component ../newer-cmp
'#你的组件将在src/app/newer-cmp中生成
You can find all possible blueprints in the table below:
您可以在下表中找到所有可能的蓝图:
Scaffold Usage
Component ng g component my-new-component 产生一个组件
Directive ng g directive my-new-directive 产生一个指令
Pipe ng g pipe my-new-pipe 产生一个管道
Service ng g service my-new-service 产生一个服务
Class ng g class my-new-class 产生一个新的类
Guard ng g guard my-new-guard 产生一个新的守卫
Interface ng g interface my-new-interface 产生一个新的interface
Enum ng g enum my-new-enum 产生一个新的枚举
Module ng g module my-module 产生一个新的模块
Updating Angular CLI:更新Angular CLI
If you're using Angular CLI beta.28 or less, you need to uninstall angular-cli package. It should be done due to changing of package's name and scope from angular-cli to @angular/cli:
如果您使用Angular CLI beta.28或更低版本,则需要卸载angular-cli软件包。 应该这样做,因为将包名和范围从angular-cli更改为@ angular / cli:
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
To update Angular CLI to a new version, you must update both the global package and your project's local package.
要将Angular CLI更新到新版本,必须同时更新全局包和项目的本地包。
Global package:全局包
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
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
You can find more details about changes between versions in CHANGELOG.md.
您可以在CHANGELOG.md中找到有关版本之间更改的更多详细信息。
Development Hints for hacking on Angular CLI:开发提示在Angular CLI上的黑客
Working with master
git clone https://github.com/angular/angular-cli.git
cd angular-cli
npm link
Documentation
文档
The documentation for the Angular CLI is located in this repo's wiki.
angular ClI的文档都在这个专题的wiki上面
License:许可证
MIT:麻省理工学院