Compile time configuration options allow you to provide different kind of settings based on the environment you're building the Angular app for. You might for instance have a development, staging and production environment. With the Angular CLI you're already perfectly set up. Whenever you compile your app, you just pass the --env=<your-environment> to the CLI. The according settings will then be compiled into your app. But let's take a closer look how that works and how you can define new environments by yourself

You can add env setting in environement folder, or even create new environement file.

For example:

//environment.staging.ts

export const environment = {
production: true,
appTitle: 'NG app (staging)'
};

Run the env:

"build:staging": "ng build --prod --env=staging",

[Angular] Configure an Angular App at Compile Time with the Angular CLI的更多相关文章

  1. Angular.JS + Require.JS + angular-async-loader 来实现异步加载 angular 模块

    传统的 angular 应用不支持异步加载模块,必须在 module 启动的时候,所有模块必须预加载进来. 通过使用 angular-async-loader 库,我们可以使用 requirejs 等 ...

  2. [Angular] Configure an Angular App at Runtime

    It always again happens (especially in real world scenarios) that you need to configure your Angular ...

  3. [Angular Tutorial]PhoneCat Tutorial App

    (注:曾经在<不敢止步>一书中看到学到一个观点,作者认为学习一门技术最好的方法就是翻译某部领域书籍.这里我决定做一次尝试,接下来花1个月左右时间,将Angular Tutorial Pho ...

  4. 002——Angular 目录结构分析、app.module.ts 详解、以及 Angular 中创建组件、组件 详解、 绑定数据

    一.目录结构分析 二. app.module.ts.组件分析 1.app.module.ts 定义 AppModule,这个根模块会告诉 Angular 如何组装该应用. 目前,它只声明了 AppCo ...

  5. Angular 学习笔记 ( PWA + App Shell )

    PWA (Progressive Web Apps) 是未来网页设计的方向. 渐进式网站. Angular v5 开始支持 pwa 网站 (所谓支持意思是说有一些 build in 的方法和规范去实现 ...

  6. [Angular] Read Custom HTTP Headers Sent by the Server in Angular

    By default the response body doesn’t contain all the data that might be needed in your app. Your ser ...

  7. [Angular Directive] Assign a Structual Directive a Dynamic Context in Angular 2

     Just like passing in an array to *ngFor, you can pass in any value into your structural directive s ...

  8. [Angular Directive] Implement Structural Directive Data Binding with Context in Angular

    Just like in *ngFor, you're able to pass in data into your own structural directives. This is done b ...

  9. [Angular] Create a custom validator for template driven forms in Angular

    User input validation is a core part of creating proper HTML forms. Form validators not only help yo ...

随机推荐

  1. 让前端攻城师独立于后端进行开发: Mock.js

    一.Mock.js是什么? 目前的大部分公司的项目都是采用的前后端分离, 后端接口的开发和前端人员是同时进行的. 那么这个时候就会存在一个问题, 在页面需要使用大量数据进行渲染生成前, 后端开发人员的 ...

  2. SpringBoot下支付宝接口的使用

    SpringBoot下支付宝接口的使用 前期准备: 参考之前写过的 支付宝接口引入servlet版本 Jar包引入: <!-- 支付宝 --> <dependency> < ...

  3. tp框架,addAll方法报错,返回false

    tp框架的批量添加addAll($data)方法很实用,但是注意,数据数组的数据结构要保持一致,不然会返回false.

  4. 监控SQLserver计数器

  5. angular-Scope

    Scope(作用域) 是应用在 HTML (视图) 和 JavaScript (控制器)之间的纽带. Scope 是一个对象,有可用的方法和属性. Scope 可应用在视图和控制器上. 当你在 Ang ...

  6. EOSS V3.0.2 企业运营支撑系统(基于RBAC原理的权限管理)

    下载地址:https://github.com/jelly-liu/EOSS 一:EOSS 功能介绍 其于用户,角色,权限,资源(即菜单)的一套"简约有用"的权限管理系统,可在其基 ...

  7. Nginx系列(四)--工作原理

    上篇文章介绍了Nginx框架的设计之管理进程以及多个工作进程的设计.master进程用来管理通过fork子进程与子进程通信.子进程通过处理进程信号接到master的通信去处理请求. Nginx工作原理 ...

  8. node.js mongodb ReplSet

    随着web2.0兴起,高并发大数据量的应用对数据库高速响应的性能要求日趋明显,传统的关系型数据库在这方面显得有些乏力.有矛自有盾,内存DB的出现弥补了传统关系型db的不足.眼下市面流行的内存db主要有 ...

  9. Stop being a perfectionist

    节选自 7 Things You Need To Stop Doing To Be More Productive, Backed By Science “We found that perfecti ...

  10. nyoj--18--The Triangle(dp水题)

    The Triangle 时间限制:1000 ms  |  内存限制:65535 KB 难度:4 描述 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure ...