zl程序教程

您现在的位置是:首页 >  前端

当前栏目

Angular 复习与进阶系列 – Angular CLI

Angular 系列 进阶 复习 CLI
2023-09-27 14:23:55 时间

前言

这篇会列出我开发中常用的 command. 并给予一些简单的说明


查看当前版本

ng version

 

升级项目/CLI

升级 Global CLI

npm uninstall -g @angular/cli
npm install -g @angular/cli@latest // 升级到稳定版本
npm install -g @angular/cli@next   // 升级到 preview 版本

升级项目

ng update // 查看最新稳定版
ng update --next // 查看最新 preview 版
ng update @angular/cli @angular/core --next // 更新指定 package 到最新 preview 版本

 

创建项目

ng new my-app

options

--routing    // 包含 router
--style=scss // 使用 Scss
--standalone // 默认创建 standalone 组件 (without NgModule)
--skip-tests // 不包含单元测试

 

创建组件

ng g c my-component

 

创建管道 Pipe

ng g p my-pipe

 

创建 Service

ng g s my-service