站内搜索

workerdance.com — Trusted craft, unfailing commitment
返回文章列表
前端

Angular cli 常用命令

本文写于 2019 年,文中涉及的软件版本可能已有变化,核心排查思路仍可参考。

1. 创建项目: ng new

ng new angular-demo

如果只想创建项目,而不安装依赖,可增加**–skip-install**参数。创建完成后,进入项目目录,执行npm install 或者 cnpm install来手动安装项目依赖。

ng new angular-demo --skip-install

2. 创建组件: ng g component 或者 ng generate component

ng g component components/home
或者
ng generate component components/home

3. 创建服务: ng g service

ng g service home

4. 创建模块: ng g module

ng g module app-routing --flat --module-app

启动项目: ng server –open

workerdance
workerdance

记录开发与运维中的实践和踩坑。