You can quickly delete the non-essential files that concern testing and QuickStart repository maintenance
(including all git-related artifacts such as the .git folder and .gitignore!).
请只在开始时执行此删除操作,以防你自己的测试和git文件被意外删除!
Do this only in the beginning to avoid accidentally deleting your own tests and git setup!
在项目目录下打开一个终端窗口,并根据你的操作系统执行以下命令:
Open a terminal window in the project folder and enter the following commands for your environment:
The QuickStart seed contains the same application as the QuickStart playground.
But its true purpose is to provide a solid foundation for local development.
Consequently, there are many more files in the project folder on your machine,
most of which you can learn about later.
注意/src目录中以下三个 TypeScript (.ts) 文件:
Focus on the following three TypeScript (.ts) files in the /src folder.
src
app
app.component.ts
app.module.ts
main.ts
import{Component}from'@angular/core';@Component({
selector:'my-app',template:`<h1>Hello {{name}}</h1>`})exportclassAppComponent{ name ='Angular';}
Files inside src/ "belong" to your app.
Add new Typescript, HTML and CSS files inside the src/ directory, most of them inside src/app,
unless told to do otherwise.
Defines the same AppComponent as the one in the QuickStart playground.
It is the root component of what will become a tree of nested components
as the application evolves.
Defines AppModule, the root module that tells Angular how to assemble the application.
Right now it declares only the AppComponent.
Soon there will be more components to declare.
Compiles the application with the JIT compiler and
bootstraps
the application's main module (AppModule) to run in the browser.
The JIT compiler is a reasonable choice during the development of most projects and
it's the only viable choice for a sample running in a live-coding environment like Plunker.
You'll learn about alternative compiling and deployment options later in the documentation.
Node.js and npm are essential to modern web development with Angular and other platforms.
Node powers client development and build tools.
The npm package manager, itself a node application, installs JavaScript libraries.
Verify that you are running node v4.x.x or higher and npm 3.x.x or higher
by running the commands node -v and npm -v in a terminal/console window.
Older versions produce errors.
We recommend nvm for managing multiple versions of node and npm.
You may need nvm if you already have projects running on your machine that
use other versions of node and npm.
Links on almost every documentation page open completed samples in the browser.
You can play with the sample code, share your changes with friends, and download and run the code on your own machine.
The QuickStart shows just the AppComponent file.
It creates the equivalent of app.module.ts and main.ts internally for the playground only.
so the reader can discover Angular without distraction.
The other samples are based on the QuickStart seed.
虽然有这么多的乐趣,但是...
As much fun as this is ...
你不能在 plunker 里面发布你的应用
you can't ship your app in plunker
编程时你不可能总是在线
you aren't always online when writing code
在浏览器中编译 TypeScript 很慢
transpiling TypeScript in the browser is slow
只有本地 IDE 有类型支持、代码重构和代码自动完成
the type support, refactoring, and code completion only work in your local IDE