1. 创建新的Angular空间的命令是ng new 空间名,ng new
命令会提示你输入要在初始应用项目中包含哪些特性,请按 Enter 或 Return 键接受其默认值。
2. 启动应用服务器(serve the application),//cd 空间名 //ng serve --open。(The ng serve
command builds the app, starts the development server, watches the source files, and rebuilds the app as you make changes to those files.The --open
flag opens a browser to http://localhost:4200/
.)
3. 创建一个新的组件(component)的命令是 ng generate component 组件名,该命令还会把新的组件添加到 src/app/app.module.ts
文件中 @NgModule
的 declarations
列表中。
一个component的四个基本文件分别是
-
作为组件样式的 CSS 文件。
-
作为组件模板的 HTML 文件。
-
存放组件类
HeroDetailComponent
的 TypeScript 文件。 -
HeroDetailComponent
类的测试文件。
#####下面是英文的学习记录#####
中文学习网站为https://angular.cn,英文学习网站为https://angular.io。