演示
要运行上面创建的应用程序,请从应用程序文件夹运行命令 ng serve
。
$ cd helloworld $ ng serve ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ ** Date: 2018-06-18T17:10:50.638Z Hash: 832b348b3a35e13efaf8 Time: 6365ms chunk {main} main.js, main.js.map (main) 10.7 kB [initial] [rendered] chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 227 kB [initial] [rendered] chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered] chunk {styles} styles.js, styles.js.map (styles) 15.6 kB [initial] [rendered] chunk {vendor} vendor.js, vendor.js.map (vendor) 3.06 MB [initial] [rendered] i 「wdm」: Compiled successfully.
Angular 开发环境已启动并正在运行。
打开浏览器并在 http://localhost:4200/
中验证正在运行的应用程序。
安装 Git
- 转到 Git 下载页面并根据机器配置下载安装程序。
- 执行安装程序。如果要在任何备用位置安装节点,请选择路径。我会建议使用默认选项。
- 使用此命令验证节点是否已安装。
$ git --version git version 2.17.1.windows.2 //Output
另外运行这些命令来设置你的 git 身份。
$ git config --global user.email "you@example.com" //Use your git email id $ git config --global user.name "Your Name" //Use your git name
创建 Angular Hello world
在命令提示符下转到工作区,然后运行此命令。
此命令将在“helloworld”文件夹中创建一个新的 Angular 应用程序,其中包含所有必需的文件。
$ ng new helloworld
安装 Node
- 转到节点下载页面并根据机器配置下载安装程序。
- 执行安装程序。如果要在任何备用位置安装节点,请选择路径。我会建议使用默认选项。
- 使用此命令验证节点是否已安装。
$ node --version v8.11.3 //output
下面将为 Angular、Node 和 TypeScript 设置开发环境。
欢迎来到之路教程(on itroad-com)
安装软件包
现在安装 node 和 git 后,是时候安装必要的 npm
包了。
$ npm install -g rxjs $ npm install -g typescript $ npm install -g webpack $ npm install -g webpack-cli $ npm install -g @angular/core $ npm install -g @angular/cli $ npm install -g gulp
日期:2020-09-17 00:09:14 来源:oir作者:oir