Angular随记:Angular CLI安装及使用
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
目录
一、安装 Angular CLI
二、Angular CLI 使用
1.命令总览
2.创建应用
3.启动运行项目
4.创建指定的功能文件
4.1 创建一个服务
未完待续。。。
一、安装 Angular CLI
执行如下安装命令:
npm install -g @angular/cli
执行成功后就可以执行 CLI 命令了。
二、Angular CLI 使用
1.命令总览
首先,执行 ng help,我们看下都有哪些命令。
aaaaa@xxxMacBook-Pro my-app % ng help
ng <command>Commands:ng add <collection> Adds support for an external library to yourproject.ng analytics Configures the gathering of Angular CLI usagemetrics.ng build [project] Compiles an Angular application or library into anoutput directory named dist/ at the given outputpath. [aliases: b]ng cache Configure persistent disk cache and retrieve cachestatistics.ng completion Set up Angular CLI autocompletion for yourterminal.ng config [json-path] [value] Retrieves or sets Angular configuration values inthe angular.json file for the workspace.ng deploy [project] Invokes the deploy builder for a specified projector for the default project in the workspace.ng doc <keyword> Opens the official Angular documentation(angular.io) in a browser, and searches for agiven keyword. [aliases: d]ng e2e [project] Builds and serves an Angular application, thenruns end-to-end tests. [aliases: e]ng extract-i18n [project] Extracts i18n messages from source code.ng generate Generates and/or modifies files based on aschematic. [aliases: g]ng lint [project] Runs linting tools on Angular application code ina given project folder.ng new [name] Creates a new Angular workspace. [aliases: n]ng run <target> Runs an Architect target with an optional custombuilder configuration defined in your project.ng serve [project] Builds and serves your application, rebuilding onfile changes. [aliases: s]ng test [project] Runs unit tests in a project. [aliases: t]ng update [packages..] Updates your workspace and its dependencies. Seehttps://update.angular.io/.ng version Outputs Angular CLI version.
2.创建应用
ng new [name]
创建应用详见:
Angular随记:创建一个Angular项目_鸡肋佐的博客-CSDN博客
3.启动运行项目
cd到项目目录下,执行如下命令,执行ng serve
或者npm run serve
命令启动应用。
ng serve --open
4.创建指定的功能文件
ng generate [功能类型]
ng g <schematic> Run the provided schematic. [default]ng g app-shell Generates an application shell for running aserver-side version of an app.ng g application [name] Generates a new basic application definition in the"projects" subfolder of the workspace.[aliases: app]ng g class [name] Creates a new, generic class definition in thegiven or default project. [aliases: cl]ng g component [name] Creates a new, generic component definition in thegiven or default project. [aliases: c]ng g directive [name] Creates a new, generic directive definition in thegiven or default project. [aliases: d]ng g enum [name] Generates a new, generic enum definition for thegiven or default project. [aliases: e]ng g guard [name] Generates a new, generic route guard definition inthe given or default project. [aliases: g]ng g interceptor [name] Creates a new, generic interceptor definition inthe given or default project.ng g interface [name] [type] Creates a new, generic interface definition in thegiven or default project. [aliases: i]ng g library [name] Creates a new, generic library project in thecurrent workspace. [aliases: lib]ng g module [name] Creates a new, generic NgModule definition in thegiven or default project. [aliases: m]ng g pipe [name] Creates a new, generic pipe definition in the givenor default project. [aliases: p]ng g resolver [name] Generates a new, generic resolver definition in thegiven or default project. [aliases: r]ng g service [name] Creates a new, generic service definition in thegiven or default project. [aliases: s]ng g service-worker Pass this schematic to the "run" command to createa service workerng g web-worker [name] Creates a new, generic web worker definition in thegiven or default project.
4.1 创建一个服务
ng g service [name]
创建应用详见:
Angular随记:创建一个服务_鸡肋佐的博客-CSDN博客
未完待续。。。
Angular随记:Angular CLI安装及使用相关推荐
- 安装angular cli_Angular 9适用于初学者—如何使用Angular CLI安装第一个应用程序
安装angular cli Angular is one of the most popular JavaScript frameworks created and developed by Goog ...
- 记Angular与Django REST框架的一次合作(2):前端组件化——Angular
注:这是这个系列的第二部分,主要集中在Angular的使用方面.之前使用过AngularJS(Angular 1.x),混在Django的模板中使用,这些页面一般完全是结果展示页.在有Django表单 ...
- Angular 项目里 angular.json 文件内容的学习笔记
看一个基于 Angular 的 SAP Spartacus 项目里 angular.json 的例子: version: The configuration-file version. newProj ...
- Angular: 升级Angular 14到Angular 15
N个月前写过一篇Angular: 升级Angular 13到Angular 14 的文章.现在Angular已经发布到了V16(非GA版本),那是时候把Angular项目升级到Angular 15了. ...
- Angular: Material Design Angular教程:Material设计 Lynda课程中文字幕
Angular: Material Design 中文字幕 Angular教程:Material设计 中文字幕Angular: Material Design Angular Material是UI组 ...
- 记一次安装多版本php的四个雷区,你踩着了吗
记一次安装多版本php的四个雷区,你踩着了吗 技术小疯子关注3人评论740人阅读2018-06-29 15:00:30 记一次安装多版本的php的四个雷区,你踩着了吗 需求:公司需要在同一台服务器上安 ...
- mysql还书过程_记一次安装 MySQL 的过程
记一次安装 MySQL 的过程 一直以来我用的 MySQL 都是从官网下载的zip压缩包,解压后自己配置的.但是这次安装时遇到了几个坑,特别在这里记录一下. 再次更新, 今天安装 MySQL 8.0. ...
- 云原生开发框架dapr环境搭建:CLI安装和初始化
dapr 是微软的一个云原生(Cloud Native)开源项目,英文全称:Distributed Application Runtime,中文要翻译的话就是:分布式应用运行时.也就是一个运行时框架, ...
- angular java_带有Angular JS的Java EE 7 –第1部分
angular java 今天的帖子将向您展示如何使用Java EE 7和Angular JS构建一个非常简单的应用程序. 在去那里之前,让我告诉您一个简短的故事: 我必须承认,我从来都不是Java语 ...
最新文章
- workspace-project-target关系与解耦工程结构总结
- MSDN电子杂志上有关TFS的文章
- nc扫描端口-curl-手动查杀木马过程之生成木马程序病原体并自动运行
- Java的“ for each”循环如何工作?
- ecshop实现弹出登录框
- 解决办法:look up error: undefined symbol
- MCSE 2012 R2之工作文件夹Word Folders(2)
- 如何打开屏幕坏的手机_手机屏幕坏了如何打开usb调试
- 统计学考试带计算机,统计学试题
- 超宽带 DWM1000模块 校准
- STL库和Boost库
- 如何在苹果iPhone或iPad上启用SSL证书
- debian linux系统安装教程,Debian 10(Buster)安装过程图文详解
- 浅谈CPU位数和操作系统位数
- 微信辅助注册平台源码
- k-fold cross validation 相关的帖子、论文 建议收藏哦 ~
- 海量CAD图纸哪里获取呢?
- 网络-4 【http状态码、accept、Content-Type】
- mysql优化 wordpress_WordPress优化Mysql InnoDB转MYISAM
- 30天自制操作系统笔记(九十)
热门文章
- 牛客小白月赛3 C.博弈
- 4.0 树莓派做下位机播放视频、控制电机舵机、超声波检测、paj7620手势传感器控制,树莓派串口通信等程序分析
- 互联网公司的技术博客汇总-BAT等
- cvxpy报错Encountered unexpected exception importing solver OSQP
- 微信小程序云开发沉浸式(透明)状态栏的实现(怎么写)
- 计算机英语化工版,计算机英语(主编苏兵-化工版)教案:7 What is multimedia.doc...
- 平方根法 乔累斯基分解Cholesky_解线性方程组的直接解法
- 手把手教你做一个安卓点餐系统
- NLP01(自然语言处理)第一章 绪论
- 高通骁龙855,麒麟980,A12,Exynos 9820芯片参数比较