我按照这个教程http://ej2.syncfusion.com/angular/documentation/grid/getting-started.html
然而,当我运行我的项目时,JIT遇到此错误
InteliSense也显示相同的错误
我将 SyncFusionModule
设置为Angular模块,以导出我计划在 BenchmarkModule
中使用的所有"Syncfusion EJ 2 for Angular"组件 . @syncfusion/ej2-ng-grids/src/grid/index
中的 GridComponent
可以被Angular选中;因此,它被认为是角度成分 . 但是, datasouce
未在'GridComponent'中声明,而是在其父级 Grid
中声明,它不是Angular组件,而是在 @syncfusion\ej2-grids
中声明的标准组件 . 好像我错过了某个依赖项导入来帮助Angular找到 Grid
的定义 . 但我不知道如何解决这个问题 .
起初,我认为这是因为我跳过了http://ej2.syncfusion.com/angular/documentation/grid/getting-started.html#configuring-system-js中描述的SystemJS映射;因此,我提出了这个问题Webpack solution for SystemJS mapping . 但其中一个答案表明我可能不是原因 .
这里是GitHub repo https://github.com/lamLeX/IocPerformance/tree/gh-pages/IocPerformanceResultWebApp/src/app,以防有人想知道文件是如何构造的,以帮助我解决依赖关系,因为我没有太多的JS依赖解析经验;特别是ES6模块解析 .
从答案更新:故障代码取自此示例http://ej2.syncfusion.com/angular/demos/#/grid/grouping,我已通知SyncFusion团队有关示例代码中的错误 .
<div class="control-section">
<ej-grid height="320" [datasource]="data" [groupsettings]="groupOptions" [allowgrouping]="true" allowsorting="true" allowpaging="true">
<e-columns>
<e-column field="Inventor" width="180" headertext="Inventor Name"></e-column>
<e-column field="NumberofPatentFamilies" width="220" textalign="right" headertext="Number of Patent Families"></e-column>
<e-column field="Country" width="140" headertext="Country"></e-column>
<e-column field="Active" width="120"></e-column>
<e-column field="Mainfieldsofinvention" width="200" headertext="Main fields of invention"></e-column>
</e-columns>
</ej-grid>
<div style="margin-top: 10px; text-align: right">Source:
<a href="https://en.wikipedia.org/wiki/List_of_prolific_inventors" target="_blank">Wikipedia: List of Prolific inventors</a>
</div>
</div>
1 回答
它是
ej2-ng-grids
,而不是ej2-grids
和GridModule is right there . 所以它应该是并且没有必要这样做,因为这已经在GridAllModule中完成了 . 它应该在应用程序模块中导入,而不是自定义
SyncFusionModule
.此外,上面的代码包含错误的输入 -
datasource
等_129145_ dataSource`等等,according to the documentation .