4
我使用的角度2. ES5的味道和我遇到這個錯誤:如何查找哪些組件發生衝突?
Unhandled Promise rejection: Template parse errors:
More than one component matched on this element.
Make sure that only one component's selector can match a given element.
Conflicting components: class2,class6 ("
</tbody>
</table>
[ERROR ->]<paging [data]="data" (changed)="loadCountries($event)" unit="country"></paging>
<md-spinner class="lis"): [email protected]:0 ; Zone: <root> ; Task: Promise.then ; Value:
它說class2
和class6
。我找不到這些課程的原始名稱。
這裏是我的模塊定義:與...
指定
var module = ng.core.NgModule({
imports: [
ng.platformBrowser.BrowserModule,
ng.router.RouterModule.forRoot([].concat([...])),
ng.material.MaterialModule,
ng.http.HttpModule,
ng.common.CommonModule,
ng.forms.FormsModule],
declarations: [
app.CoalAddWorldCoalSupply,
app.FilterValuesDialog,
app.CoalFlows,
app.ImportWorldCoalSupplies,
app.CoalProducts,
app.CoalReports,
app.CoalUpsertFlow,
app.CoalUpsertProduct,
app.CoalWorldCoalSupplies,
app.CountryList,
app.CountryUpsert,
app.Dashboard,
app.ElectricityHeatGenerations,
...
],
entryComponents: [app.FilterValuesDialog, confirmDialog],
bootstrap: [app.Layout],
providers: [globalService]
})
.Class({
constructor: function() { }
});
document.addEventListener('DOMContentLoaded', function() {
ng.platformBrowserDynamic
.platformBrowserDynamic()
.bootstrapModule(module);
});
零件意味着更多的同樣的事情。
如何瞭解zone.js
所指的類別?
sooooooooooooo涼爽。 +1 –
非常感謝您製作該gif並展示如何調試和查找相沖突的組件。我不會想到我自己。對於我的問題,我正在導入一個導出MatButtonModule的UI庫,但我的主項目也是如此。通過像這樣調試,我能夠發現兩個UI庫都在導出MatButtonModule,這就產生了一個衝突,因爲現在我的項目有兩個競爭渲染這個材質的es5.js文件模塊 –
我承認我必須觀察調試幾次想要看看你在做什麼,我唯一的願望是它沒有跑得這麼快,但是我能夠跟隨並最終弄清楚。 –