Suppose I would like to use SAP Spartacus directive cxComponentWrapper in my custom Component,and error message is:

Can’t bind to ‘cxComponentWrapper’ since it isn’t a known property of ‘ng-container’.\n1.

This is caused by missing import. However, how can we know which module should be imported from where?

The tip is to check it out in SAP Spartacus source code. Suppose you have already cloned it from github: https://github.com/SAP/spartacus

search source code by keyword “cxComponentWrapper”, there should be plenty of hits, for example tab-paragraph-container.component.html:

I am using Visual Studio Code for Spartacus development, and installed the plugin Angular Language Service:

With this plugin, simply press Ctrl + mouse left click, to automatically navigate to implementation part of cxComponentWrapper directive, it’s here:


Here we can know cxComponentWrapper directive is exported via module : PageComponentDirective:

As a result, in my application module, just add PageComponentModule into app module’s imports section, and the error is gone:

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

如何找到Angular应用的某个directive是属于哪一个Angular module相关推荐

  1. 使用angular的好处_在项目中使用Angular的最大好处

    使用angular的好处 by Irina Sidorenko 伊琳娜·西多连科(Irina Sidorenko) 在项目中使用Angular的最大好处 (The top benefits of us ...

  2. angular搭建项目步骤_建立健康的Angular项目应采取的步骤

    angular搭建项目步骤 by Ashish Gaikwad 通过Ashish Gaikwad 建立健康的Angular项目应采取的步骤 (Steps you should take to buil ...

  3. angular发布代码有缓存_如何在Angular应用程序中执行请求?

    全文共5358字,预计学习时长16分钟 来源:Pexels 本文将讨论如何在Angular应用程序中执行请求. 1. 使用拦截器来装饰请求 2. HttpClient 与HttpBackend的对比 ...

  4. Angular学习心得之directive——require选项的细节

    2019独角兽企业重金招聘Python工程师标准>>> 谈require选项之前,应该先说说controller选项,controller选项允许指令对其他指令提供一个类似接口的功能 ...

  5. 关于调用 Angular 属性指令 attribute Directive 是否需要带中括号的问题

    属性型指令,应用在宿主元素时不需要中括号: 效果如下图黄色高亮区域所示: 从外界传值给 Angular attribute Directive: 这里需要给 highlight Directive 创 ...

  6. Angular里的structural directive的一个例子

    在product-list.component.html里,编写如下代码: <h2>Jerry Products</h2><div *ngFor="let pr ...

  7. Angular运行在java_在本地运行现有Angular项目

    我是Angular的新手,我正在尝试在我的机器上运行Angular的现有项目 . 我做了很多测试并且跟着很多文章 . 但无法运行我的项目 . 我有这样的项目文件: 我在我的系统上安装了nodejs . ...

  8. abp angular 和mvc_使用.net core ABP和Angular模板构建博客管理系统(实现自己的业务逻辑)...

    返回目录 之前写到使用.net core ABP 和Angular模板构建项目,创建后端服务.文章地址:http://www.jianshu.com/p/fde1ea20331f 创建完成后的api基 ...

  9. 使用Angular CLI创建一个Hello World级别的Angular应用

    命令行ng new my-first-project, 会自动创建一个同名文件夹,stylesheet的实现,选择最简单的css即可. Angular CLI会在my-first-project文件夹 ...

最新文章

  1. 听说又有兄弟因为用YYYY-MM-dd 被锤了...
  2. linux 下面数据库备份
  3. c# 实现 加减乘除
  4. C#图片处理示例(裁剪,缩放,清晰度,水印)
  5. [CTO札记]互联网一定要免费吗?网络文学是继网络游戏后又一成功的收费模式...
  6. Java中的string定义的两种方法和区别
  7. python程序入门设计_程序设计入门—Python
  8. 视觉SLAM十四讲(2):初识SLAM
  9. Python:通过SNMP协议获取华为交换机的ARP地址表
  10. Spring的@bean注解
  11. C语言排序方法-----冒泡排序法
  12. Python3安装cx_Oracle连接oracle数据库实操总结
  13. 如何使用jQuery更改超链接的href
  14. Vegas18 pro视频编辑软件下载官方激活码-序列号-密钥版-注册
  15. cad布局怎么用_【CAD】CAD布局怎么用?
  16. Saliency Detection: A Spectral Residual Approach 阅读笔记
  17. linux下搜索丢失分区,找回丢失的Linux分区拯救我的硬盘
  18. [技术]使用人工智能玩微信跳一跳
  19. 将文本保存为TXT文档
  20. 微博推荐算法学习(Weibo Recommend Algolrithm)

热门文章

  1. listview滚动到底部
  2. maven项目添加jar包
  3. python之时间日期time
  4. BZOJ3173 [TJOI2013]最长上升子序列
  5. mysql集群安装指南
  6. AngularJs详细
  7. HappyLeetcode50:Rotate Array
  8. linux命令详解:file命令
  9. 讲讲Linq to SQL映射(基础篇)
  10. LinkButton指定ClientOnClick的问题