求解GridComponent我跟着這個教程http://ej2.syncfusion.com/angular/documentation/grid/getting-started.html依賴於@ syncfusion/EJ2-NG-電網
我將SyncFusionModule
設置爲Angular Module來導出所有「Syncfusion EJ 2 for Angular」組件我打算在BenchmarkModule
中使用它。可以通過Angular獲取GridComponent
中的 @syncfusion/ej2-ng-grids/src/grid/index
;因此,它被認爲是一個角度組件。但是,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>
這裏GridModule不在模塊中導入,https://github.com/lamLeX/IocPerformance/blob/gh-pages/IocPerformanceResultWebApp/src/app/sync-fusion/sync-fusion.module.ts 。我想這就是問題所在。對於非Angular組件,可能有其他選項,但對於Angular組件,當組件聲明丟失時會發生此錯誤。 – estus
我試圖從'@synfusion/ej2-grids'添加導入{Grid};在發佈問題之前,仍然收到了錯誤 – LxL
,並且在'@ NgModule'中添加Grid來導入數組只會生成另一個錯誤,說明模塊'SyncFusionModule'導入了'Unexpected value'Grid'。請添加@NgModule註釋。# – LxL