Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript @syncfusion/ej2 ng grids中GridComponent的依赖项求解_Javascript_Angular_Ecmascript 6_Syncfusion_Es6 Modules - Fatal编程技术网

Javascript @syncfusion/ej2 ng grids中GridComponent的依赖项求解

Javascript @syncfusion/ej2 ng grids中GridComponent的依赖项求解,javascript,angular,ecmascript-6,syncfusion,es6-modules,Javascript,Angular,Ecmascript 6,Syncfusion,Es6 Modules,我遵循了这个教程 然而,每当我运行我的项目时,JIT都会遇到这个错误 IntelliSense也显示了同样的错误 我将SyncFusionModule设置为角度模块,以导出我计划在BenchmarkModule中使用的所有“Syncfusion EJ 2 for Angular”组件。中的GridComponent @syncfusion/ej2 ng grids/src/grid/index可通过角度传感器拾取;因此,它被认为是一个角度分量。但是,datasouce不是在“GridCompon

我遵循了这个教程

然而,每当我运行我的项目时,JIT都会遇到这个错误

IntelliSense也显示了同样的错误

我将
SyncFusionModule
设置为角度模块,以导出我计划在
BenchmarkModule
中使用的所有“Syncfusion EJ 2 for Angular”组件。中的
GridComponent
@syncfusion/ej2 ng grids/src/grid/index
可通过角度传感器拾取;因此,它被认为是一个角度分量。但是,
datasouce
不是在“GridComponent”中声明的,而是在其父级
Grid
中声明的,该父级
Grid
不是角度组件,而是在
@syncfusion\ej2 grids
中声明的标准组件。似乎我错过了一个依赖项导入,它可以帮助Angular找到
网格的定义。但我不知道如何解决这个问题

起初,我认为这是因为我跳过了中描述的SystemJS映射;所以我提出这个问题。但其中一个答案告诉我这可能不是原因

这里是GitHub repo,以防有人想知道文件的结构如何来帮助我解决依赖关系,因为我在JS依赖关系解决方面没有太多经验;特别是ES6模块

根据答案更新: 故障代码取自此示例,我已将示例代码中的错误通知了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网格
,而不是
ej2网格
,以及。应该如此

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 { }
没有必要这样做,因为这已经在中国完成了。它应该导入到应用程序模块中,而不是自定义的
SyncFusionModule


此外,上面的代码包含错误的输入-
数据源
,等等。
它们应该是
数据源`等等。

此处GridModule未在模块中导入。我想这就是问题所在。对于非角度组件,可能还有其他选项,但对于角度组件,当缺少组件声明时会发生此错误;在发布问题之前,但仍然收到错误,并且在
@NgModule
中将网格添加到导入数组只会生成另一个错误,称为
模块“SyncFusionModule”导入的意外值“Grid”。请添加@NgModule注释。
是的,编译器会为您进行调试。它应该是从“@syncfusion/ej2 grids”导入{GridModule}
和导入:[GridModule]。这应该适合您。在
@syncfusion/ej2 grids
中没有
GridModule
<代码>网格位于
@syncfusion/ej2网格
中,
网格组件
位于
@syncfusion/ej2 ng网格
GridModule
是一个角度模块,它在其
declarations
exports
数组中声明和导出
GridComponent
。我试图在我的
SyncFusionModule
中使用“@syncfusion/ej2 grids”中的“import{Grid};”导入网格正如您所建议的,但JIT仍然无法找到网格的属性。您是否建议这正是我在这里所做的?您是否尝试调用ng SERVICE并在您的计算机上本地尝试它?我还尝试替换
SyncFusionModule
中的所有导入语句,并将它们替换为
GridAllModule
。仍然存在相同的错误。当您使用GridAllModule时,根本不需要SyncFusionModule之类的东西。您可能会继续收到此错误,因为它是,而不是
datasource
groupsettings
,等等。幸运的是,Angular可以检测到这些打字错误。它可以工作。我知道js是区分大小写的,但我不知道它适用于httml绑定:D。我选择使用
SyncFusionModule
的原因是因为以后我计划导出@syncfusion/ej2 ng图表。请更新您的答案,以添加关于数据源的分辨率,好吗?非常感谢你花时间处理这个案子。