源代码:

import { Injectable } from '@angular/core';
import { Config } from '../../config/config-tokens';@Injectable({providedIn: 'root',useExisting: Config,
})
export abstract class FeaturesConfig {features?: {[featureToggle: string]: string | boolean;};
}

FeatureConfig需要注入config-tokens里提供的Config.

Configuration injection token创建的factory方法:


而Configuration又依赖于DefaultConfiguration,因此需要先注入后者:



调用_currentInjector.get拿到DefaultConfigurationToken的实例。

_currentInjector的类型是R3Injector:


records字段里有注入好的实例:

this.records是一个map,首先检查传入的token是否已经在map里存在:


这个record里的属性很多:


感觉有很多module都使用了DefaultConfigurationChunk作为injection token

以这个cmsStoreConfigFactory工厂为例:cmsStoreConfigFactory

看个例子:

provideDefaultConfigFactory是一个helper function,接收另一个factory函数作为输入。

调用工厂函数获得value:

遍历这119条记录:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

SAP Spartacus FeaturesConfig相关推荐

  1. SAP Spartacus ConfigurationService

    位于文件configuration.service.ts内: import { Inject, Injectable, OnDestroy } from '@angular/core'; import ...

  2. SAP Spartacus 4.0 版本因为 hamburger 依赖导致构建出错的问题

    build from Schematics 遇到错误消息: SassError: Undefined function. https://github.com/SAP/spartacus/issues ...

  3. SAP Spartacus UI 服务器端渲染的调试启动方式 - debug 模式

    首先确认你已经熟悉这篇文章的启动方式:SAP Spartacus develop branch 的服务器端渲染启动方式. 第一步 添加一个新的 build script,把 --configurati ...

  4. SAP Spartacus Session affinity

    参见这个讨论. 后端运行在多个 pods/节点时,当子序列请求过早进入时,后端将无法跨集群发送缓存失效请求.此外,如果多个请求分散在多个节点上,则会消耗延迟和不必要的资源. 对于单个客户端,Spart ...

  5. SAP Spartacus 4.0 的技术变化

    在您迁移到 4.0 版库之前,我们强烈建议您切换到新的应用程序结构和新的功能库. 在多个小步骤中进行迁移更容易(迁移到新的应用程序结构,切换到提取的功能库,然后迁移到 4.0),您可以确保在每一步之后 ...

  6. SAP Spartacus travis ci-scripts 下面 e2e-cypress.sh 的实现分析

    文件地址:https://github.com/SAP/spartacus/blob/develop/.travis.yml 里面引用到了 e2e-cypress.sh: https://github ...

  7. SAP Spartacus 里的 .release-it.json 文件

    在 SAP Spartacus package.json 里有一个依赖叫做 release-it: 这个工具的链接:https://github.com/release-it/release-it 这 ...

  8. SAP Spartacus PageLayoutComponent 如何知道自己应该显示哪些具体内容

    我们以前介绍过,经过 SAP Spartacus 路由配置后的 routes 数组,其 route 数据结构的 Component 属性,清一色指向 generic 的 PageLayoutCompo ...

  9. SAP Spartacus UI Duplicated keys has been found in the config of i18n chunks

    在测试 SAP Spartacus 3.4.5 版本的 SSR 功能时,发现一个 warning 信息: console.warn(`Duplicated keys has been found in ...

最新文章

  1. linux 学习笔记 (五)
  2. 升级鸿蒙实例,华为鸿蒙 HarmonyOS 最新动作:上线 40+ 个 Sample 示例应用
  3. php yat grpc,Laravel 5 使用 Grpc 构建的微服务
  4. 51Nod 1007 正整数分组 | DP (01背包)
  5. Spring的bean管理注解和配置文件混合使用
  6. .NET 6新特性试用 | 热重载
  7. ASP.NET Core URL Rewrite中间件
  8. python抓取交易所_Python百行代码抓取美股三大交易所历史数据
  9. android 图片查看器
  10. Ubuntu16.04安装Unity3d2019.2.6
  11. 常用easyUI -icon 图标
  12. 树梅派学习 15. 语音合成软件使用
  13. wz框架登录功能详解——demo1
  14. foobar2000_备份Foobar2000并将其传输到新计算机
  15. [NodeJS] Mongoose Populate 基本使用
  16. IDEA敏感数据检测实践整理
  17. 机器学习(回归二)——线性回归-最小二乘-代码实现
  18. Windows电脑双屏设置不一样的壁纸
  19. 如何让企业员工不觉得知识库是个鸡肋,附带工具推荐
  20. arXiv每日推荐-5.5:计算机视觉/图像处理每日论文速递

热门文章

  1. c#中contextMenuStrip与datagridview使用CellMouseDown事件及treeview使用mousedown事件
  2. C++中如何去掉std::string对象的首尾空格
  3. C语言结构体实现类似C++的构造函数
  4. MySQL事务的介绍+事务的特性+事务的开启
  5. bzoj3144: [Hnoi2013]切糕(最小割)
  6. 【线段树 集合hash】bzoj4373: 算术天才⑨与等差数列
  7. [Go] 正则表达式 示例
  8. asp.net 字符串过滤
  9. flash 语法 入门
  10. sklearn自学指南(part15)--广义线性回归