Angularv4.初体验
1455 浏览 5 years, 10 months
2 入门准备 Getting Started
版权声明: 转载请注明出处 http://www.codingsoho.com/02 Getting Started
Angular version 4
官方网站 https://angular.io
参考安装手册 https://www.codingforentrepreneurs.com/blog/angular-setup-guide/
安装npm,完成之后检查安装版本
npm --version
2.15.1
node -v
v4.4.3
通过npm安装Angular CLI
初次安装失败,因为上面的node和npm版本太低
升级版本
node -v
v7.6.0
npm --version
4.1.2
手动安装
解压文件,能后将module路径加到Path
ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.7.4
Node: 7.6.0
OS: win32 x64
Angular:
...
安装指定版本
npm install -g @angular/cli@1.7.4
ng upgrade
- https://stackoverflow.com/questions/48970553/want-to-upgrade-project-from-angular-v5-to-angular-v6
- https://update.angular.io/
https://stackoverflow.com/questions/48230917/how-to-install-angular-cli-with-angular-v4-x
- https://blog.thoughtram.io/angular/2015/10/24/upgrading-apps-to-angular-2-using-ngupgrade.html
- https://stackoverflow.com/questions/47070229/how-to-update-upgrade-from-angular-4-to-angular-5
卸载angular/cli(windows)
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean
Delete the C:\Users\YOU\AppData\Roaming\npm\node_modules\@angular folder.
例如:rm -rf C:\Users\bhe001\AppData\Roaming\npm\node_modules\@angular
创建应用
创建文件夹ngSrvup,用于项目目录
mkdir ngSrvup
创建应用Srvup
ng new srvup
在应用下面会创建一些文件,放在srvup文件夹下,跟视频项目同步,将文件夹名改为client,因为angular只是个前端程序。
启动模拟器
ng serve
也可以用--port
指定不同的端口