@syncfusion/ej2-ng-grids 中 GridComponent 的依赖解决
Dependencies solving for GridComponent in @syncfusion/ej2-ng-grids
我遵循了这个教程http://ej2.syncfusion.com/angular/documentation/grid/getting-started.html
如何在我的项目 运行 中,JIT 遇到这个错误
InteliSense 也显示同样的错误
我将 SyncFusionModule
设置为 Angular 模块以导出我计划在 BenchmarkModule
中使用的所有 "Syncfusion EJ 2 for Angular" 组件。 GridComponent
在
@syncfusion/ej2-ng-grids/src/grid/index
可以被Angular捡到;因此,它被识别为 Angular 组件。但是,datasouce
没有在 'GridComponent' 中声明,而是在其父 Grid
中声明,它不是 Angular 组件,而是在 @syncfusion\ej2-grids
中声明的标准组件。似乎我错过了某处的依赖项导入以帮助 Angular 找到 Grid
的定义。但我不确定如何解决这个问题。
起初,我认为这是因为我跳过了 http://ej2.syncfusion.com/angular/documentation/grid/getting-started.html#configuring-system-js; therefore, I raised this question 中描述的 SystemJS 映射。但是其中一个答案告诉我这可能不是原因。
这是 GitHub 回购 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>
是ej2-ng-grids
,不是ej2-grids
,而是GridModule
is right there。所以应该是
import { NgModule } from '@angular/core';
import { GridModule, GridComponent, PageService, SortService, FilterService, GroupService } from '@syncfusion/ej2-ng-grids';
@NgModule({
imports: [GridModule],
exports: [GridModule],
declarations: [],
providers: [PageService, SortService, FilterService, GroupService]
})
export class SyncFusionModule { }
并且没有必要这样做,因为这已经在 GridAllModule
中完成了。它应该在应用程序模块中导入而不是自定义 SyncFusionModule
.
此外,上面的代码包含错误的输入 - datasource
,等等 They should be
dataSource` 等等,according to the documentation。
我遵循了这个教程http://ej2.syncfusion.com/angular/documentation/grid/getting-started.html
如何在我的项目 运行 中,JIT 遇到这个错误
InteliSense 也显示同样的错误
我将 SyncFusionModule
设置为 Angular 模块以导出我计划在 BenchmarkModule
中使用的所有 "Syncfusion EJ 2 for Angular" 组件。 GridComponent
在
@syncfusion/ej2-ng-grids/src/grid/index
可以被Angular捡到;因此,它被识别为 Angular 组件。但是,datasouce
没有在 'GridComponent' 中声明,而是在其父 Grid
中声明,它不是 Angular 组件,而是在 @syncfusion\ej2-grids
中声明的标准组件。似乎我错过了某处的依赖项导入以帮助 Angular 找到 Grid
的定义。但我不确定如何解决这个问题。
起初,我认为这是因为我跳过了 http://ej2.syncfusion.com/angular/documentation/grid/getting-started.html#configuring-system-js; therefore, I raised this question
这是 GitHub 回购 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>
是ej2-ng-grids
,不是ej2-grids
,而是GridModule
is right there。所以应该是
import { NgModule } from '@angular/core';
import { GridModule, GridComponent, PageService, SortService, FilterService, GroupService } from '@syncfusion/ej2-ng-grids';
@NgModule({
imports: [GridModule],
exports: [GridModule],
declarations: [],
providers: [PageService, SortService, FilterService, GroupService]
})
export class SyncFusionModule { }
并且没有必要这样做,因为这已经在 GridAllModule
中完成了。它应该在应用程序模块中导入而不是自定义 SyncFusionModule
.
此外,上面的代码包含错误的输入 - datasource
,等等 They should be
dataSource` 等等,according to the documentation。