代码改变世界

angular项目搭建

2019-08-16 15:02  雄风狂飙  阅读(399)  评论(0)    收藏  举报

1.参考https://angular.io/start 入门教程,在https://stackblitz.com中按照教程撸完代码。

2.安装node.js

3.下载在stackblitz中的项目源码。

4.在本地新建项目

npm install -g @angular/cli

ng new myProject

cd到项目目录下面,用下载下来的src下面的内容替换生成的项目中的src目录下面的内容

5.编译

ng build --prod

 

6.cd到发布包下面,在dist目录下面

执行npm start,就启动了项目。

或者执行 ng serve --open 也可以启动项目

启动界面如下:

D:\MyProduction\tmp\angular\myProject\dist>npm start

> my-project@0.0.0 start D:\MyProduction\tmp\angular\myProject
> ng serve

10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html
chunk {main} main.js, main.js.map (main) 37.1 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 253 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.09 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 23.2 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 4.45 MB [initial] [rendered]
Date: 2019-08-16T06:45:59.939Z - Hash: 5971d87e1034a8fb49fd - Time: 8224ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Compiled successfully.