angular2.x 4.x使用

前端之家收集整理的这篇文章主要介绍了angular2.x 4.x使用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

推荐大漠的Angular2优质学习资源收集@H_301_1@

angular2 和 angular4 老手都懂得区别,不多说@H_301_1@

各种问题。。。@H_301_1@

安装angular-cli

使用npm安装angular-cli@H_301_1@

以前这样npm install -g angular-cli@H_301_1@

现在这么安装@H_301_1@

npm install -g @angular/cli

然后就安装好了?(⊙﹏⊙)b 这是不可能的。。。因为GFW的原因会安装失败@H_301_1@

安装过程中有个node-sass包会下载失败@H_301_1@

不要使用cnpm安装,不要问我为什么@H_301_1@

如果你能访问github.com,就设置国内的淘宝npm镜像@H_301_1@

npm config set registry https://registry.npm.taobao.org

不能访问github,设置代理服务器@H_301_1@

代理地址http://127.0.0.1:1080,这个你懂得。。。@H_301_1@

还要把镜像设置回来@H_301_1@

npm config set proxy=http://127.0.0.1:1080
npm config set registry=http://registry.npmjs.org

基本使用

创建一个项目@H_301_1@

ng new ngtest

然后进入到这个目录@H_301_1@

浏览项目@H_301_1@

# ng serve 可以简写成下面的方式
ng s

浏览器访问 http://localhost:4200@H_301_1@

使用生成模式和预编译模式,这样会压缩项目@H_301_1@

ng serve --prod --aot

生成项目@H_301_1@

# 两个都行
ng b
ng build

会在目录下面生成一个dist的文件夹@H_301_1@

使用生成模式和预编译模式,这样会压缩项目@H_301_1@

# 两个都行
ng b --prod --aot
ng build --prod --aot

UI组件库

ng2-bootstrap https://github.com/valor-software/ng2-bootstrap/bootstrap不解释@H_301_1@

改成 ngx-bootstrap 了https://github.com/valor-software/ngx-bootstrap@H_301_1@

PrimeFaceshttp://www.primefaces.org/ 没用过@H_301_1@

Angular Materialhttps://material.angular.io/google官方android风格@H_301_1@

Ionichttp://ionicframework.com/主要用于手机端@H_301_1@

猜你在找的Angularjs相关文章