Change the default Angular project

Understanding it's purpose and limits

Nov 6, 2018

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-appmy-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: servebuildteste2e and xi18n.
Libraries: build and test.


angular default project (angular.json的解读)的更多相关文章

  1. [转]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 ...

  2. 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 ...

  3. AngularJs angular.uppercase、angular.lowercase、angular.fromJson、angular.toJson

    angular.uppercase 将指定的字符串转换成大写 格式:angular.uppercase(string); string:被转换成大写的字符串. 使用代码: var str = &quo ...

  4. Angular - - angular.uppercase、angular.lowercase、angular.fromJson、angular.toJson

    angular.uppercase 将指定的字符串转换成大写 格式:angular.uppercase(string); string:被转换成大写的字符串. 使用代码: var str = &quo ...

  5. 使用Angular CLI生成 Angular 5项目

    如果您正在使用angular, 但是没有好好利用angular cli的话, 那么可以看看本文. Angular CLI 官网: https://github.com/angular/angular- ...

  6. Angular 学习笔记 (Angular 9 & ivy)

    refer : https://blog.angularindepth.com/all-you-need-to-know-about-ivy-the-new-angular-engine-9cde47 ...

  7. Angular 1与 Angular 2之间的一些差别

    现在在用ng1.5.8做一个项目,ng的优点和特性我就不用多说了,ng1在陆续更新到1.5/1.6后就没再推出新版本了,ng2已经面世测试很久了,如同很多系统和框架一样,每个大的版本更新都会有新特性加 ...

  8. AngularJs angular.injector、angular.module

    angular.injector 创建一个injector对象, 调用injector对象的方法可用于获取服务以及依赖注入. 格式:angular.injector(modules); modules ...

  9. angular.js 的angular.copy 、 angular.extend 、 angular.merge

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

随机推荐

  1. Best quotes from The Vampire Diary(《吸血鬼日记》经典台词)

    1. I will start fresh, be someone new. 1. 我要重新开始,做不一样的自己. 2. It's the only way I'll make it through. ...

  2. 步步为营-66-Socket通信

    1.0 版本 1.1 服务器端 using System; using System.Collections.Generic; using System.Linq; using System.Net; ...

  3. ERP简介(一)

    ERP是针对物资资源管理(物流).人力资源管理(人流).财务资源管理(财流).信息资源管理(信息流)集成一体化的企业管理软件 一:系统模块简介:

  4. linux安装memcached安装以及memcache的php扩展

    https://blog.csdn.net/sshcnwold/article/details/79085082

  5. [ZJOI2006]书架

    链接:https://www.luogu.org/problemnew/show/P2596 题解: 写了两天的平衡树终于大概弄好了所有模板(模板不熟写错debug真是要死) 对于放在头尾,只需要删除 ...

  6. python常用内建模块--datetime

    datetime模块中的datetime类: 获取当前时间:datetime.now() 当前操作系统时区时间,date.utctime(UTC时间) 转换成时间戳:timestamp() 和具体时区 ...

  7. 【Java】 剑指offer(57-1) 和为s的两个数字

      本文参考自<剑指offer>一书,代码采用Java语言. 更多:<剑指Offer>Java实现合集   题目 输入一个递增排序的数组和一个数字s,在数组中查找两个数,使得它 ...

  8. char与unsigned char的区别

    #include <stdio.h> int main() { unsigned ; char b = a; printf("a = %d , b = %d",a,b) ...

  9. POJ 1222 熄灯问题【高斯消元】

    <题目链接> 题目大意: 有一个5*6的矩阵,每一位是0或者1. 没翻转一位,它的上下左右的数字也为改变.(0变成1,1变成0).要把矩阵中所有的数都变成0.求最少翻转次数的方案,输出矩阵 ...

  10. 【原创】ABP之IConventionalDependencyRegistra接口分析

    类图: 作用: abp中默认把对象的注册分为5中约定注册方式: 1.AbpAspNetCoreConventionalRegistrar public class AbpAspNetCoreConve ...