网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
ng -h
等同于ng --help
,跟所有的其他命令行一样,用于查看所有命令的一个帮助命令。执行该命令可以看到 Angular CLI 所有的命令:
>ng -h
Available Commands:
add Adds support for an external library to your project.
build (b) Compiles an Angular app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.
config Retrieves or sets Angular configuration values.
doc (d) Opens the official Angular documentation (angular.io) in a browser, and searches for a given keyword.
e2e (e) Builds and serves an Angular app, then runs end-to-end tests using Protractor.
generate (g) Generates and/or modifies files based on a schematic.
help Lists available commands and their short descriptions.
lint (l) Runs linting tools on Angular app code in a given project folder.
new (n) Creates a new workspace and an initial Angular app.
run Runs a custom target defined in your project.
serve (s) Builds and serves your app, rebuilding on file changes.
test (t) Runs unit tests in a project.
update Updates your application and its dependencies. See https://update.angular.io/
version (v) Outputs Angular CLI version.
xi18n Extracts i18n messages from source code.
For more detailed help run "ng [command name] --help"
创建应用
以下示例,创建一个名为“user-management”的 Angular 应用:
ng new user-management
创建组件
以下示例,创建一个名为 UsersComponent 的组件:
ng generate component users
创建服务
以下示例,创建一个名为 UserService 的服务:
ng generate service user
启动应用
执行:
ng serve --open
此时,应用就会自动在浏览器中打开。访问地址为 http://localhost:4200/。
升级依赖
目前,Angular 社区非常活跃,版本会经常更新。对 Angular 的版本做升级,只需简单一步执行:
ng update
如果是想把整个应用的依赖都升级,则执行:
ng update --all
![img](https://i-blog.csdnimg.cn/blog_migrate/bbf8f89cac64378fed129a755a3ee135.png)
![img](https://img-blog.csdnimg.cn/img_convert/98d12671f930128d3533a2a7190161c0.png)
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618636735)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
18636735)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**