angular default project (angular.json的解读)
Change the default Angular project
Understanding it's purpose and limits
Angular's default project is nothing more than a string, set in angular.json
, to say which project should run with ng commands without a defined project.
Note: The defaultProject key was set to be deprecated in 7.0.0 , but it was blocked because there should be a large discussion about project layout for 8.x.x.
Let's create a new project called my-app
:
$ ng new my-app
It will create an angular.json with the following structure:
{
...,
"projects": {
"my-app": { ... },
"my-app-e2e": { ... },
},
"defaultProject": "my-app",
}
So, when you run ng serve
, it would serve my-app
. It would be the same as running ng serve my-app
.
Setting a new default project
To understand what values are valid, let's create a library and an application.
$ ng create application my-application
$ ng create library my-library
Now, we have the following structure:
{
...,
"projects": {
"my-app": { ... },
"my-app-e2e": { ... },
"my-application": { ... },
"my-application-e2e": { ... },
"my-library": { ... }
},
"defaultProject": "my-app",
}
The highlighted values ( my-app
, my-application
and my-library
) are the valid ones to use as the defaultProject. E2E projects are not valid ones, even if they are listed as projects, because they are used on ng e2e
.
If you created a blank workspace or just deleted the default project string, the first project you create (in this case
my-application
) will automatically be set as the default project.
Commands
Each project type has their own commands to use, for example:
Applications: serve
, build
, test
, e2e
and xi18n
.
Libraries: build
and test
.
This article is part of a collection of tips for managing Angular workspaces.
angular default project (angular.json的解读)的更多相关文章
- [转]How to Add Bootstrap to an Angular CLI project
本文转自:https://loiane.com/2017/08/how-to-add-bootstrap-to-an-angular-cli-project/ In this article we w ...
- Angular 2 to Angular 4 with Angular Material UI Components
Download Source - 955.2 KB Content Part 1: Angular2 Setup in Visual Studio 2017, Basic CRUD applicat ...
- AngularJs angular.uppercase、angular.lowercase、angular.fromJson、angular.toJson
angular.uppercase 将指定的字符串转换成大写 格式:angular.uppercase(string); string:被转换成大写的字符串. 使用代码: var str = &quo ...
- Angular - - angular.uppercase、angular.lowercase、angular.fromJson、angular.toJson
angular.uppercase 将指定的字符串转换成大写 格式:angular.uppercase(string); string:被转换成大写的字符串. 使用代码: var str = &quo ...
- 使用Angular CLI生成 Angular 5项目
如果您正在使用angular, 但是没有好好利用angular cli的话, 那么可以看看本文. Angular CLI 官网: https://github.com/angular/angular- ...
- Angular 学习笔记 (Angular 9 & ivy)
refer : https://blog.angularindepth.com/all-you-need-to-know-about-ivy-the-new-angular-engine-9cde47 ...
- Angular 1与 Angular 2之间的一些差别
现在在用ng1.5.8做一个项目,ng的优点和特性我就不用多说了,ng1在陆续更新到1.5/1.6后就没再推出新版本了,ng2已经面世测试很久了,如同很多系统和框架一样,每个大的版本更新都会有新特性加 ...
- AngularJs angular.injector、angular.module
angular.injector 创建一个injector对象, 调用injector对象的方法可用于获取服务以及依赖注入. 格式:angular.injector(modules); modules ...
- angular.js 的angular.copy 、 angular.extend 、 angular.merge
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
随机推荐
- 【ES】学习1-入门使用
参考资料: https://elasticsearch.cn/book/elasticsearch_definitive_guide_2.x/_search_lite.htm 1.查询es数据的方法 ...
- ThinkPHP中如何获取指定日期后工作日的具体日期
思路: 1.获取到查询年份内所有工作日数据数组2.获取到查询开始日期在工作日的索引3.计算需查询日期索引4.获得查询日期 /*创建日期类型记录表格*/ CREATE TABLE `tb_workday ...
- poj3696 欧拉函数引用
不知道错在哪里,永远T /* 引理:a,n互质,则满足a^x=1(mod n)的最小正整数x0是φ(n)的约数 思路:求出d=gcd(L,8) 求出φ(9L/d)的约数集合,再枚举约数x,是否满足10 ...
- bootstrap之表单和图片
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- JQuery+Ajax实战三级下拉列表联动(八)
本片文章为练习,项目中不会这样写: 一:涉及到的知识点: jQuery Dom操作 jQuery Ajax操作 ASP.net中的json操作 二:用了自动代码生成器 1.Dal层的代码: publi ...
- HDU 3336 输出包括从1到len长 字符串前缀的总个数(+DP)
Sample Input14abab Sample Output6输出包括从1到len长 字符串前缀的总个数abab:包括2个a,2个ab,1个aba,1个abab # include <cst ...
- openstack学习-Horizon安装(八)
一.安装Horizon [root@linux-node2 ~]# yum install -y openstack-dashboard 二.Horizon配置 [root@linux-node2 ~ ...
- linux下实现shell脚本自动连接mongodb数据库并创建索引
在linux下创建shell脚本
- Nightmare HDU1072
非常标准的BFS 第一次写错了很多 1.到达4时设置为墙就好了 避免了死循环 2.不用开d数组 在结构体里面就行了 3.结构体初始化函数的写法: Node(int x=0,int y=0,int ...
- 016 在大数据中,SSH无密钥登录
一:概述 1.关于ssh ssh是一种安全协议. 会生成一对公钥和私钥. 2.问题的由来 3.解决方式 将生成的公钥发送到远程的机器上. 4.位置 主目录下的.ssh文件下. 二:在伪分布式下的操作 ...