How to find which components conflict?

I am using ES5 Angular 2 flavor. And I ran into this error:

Unhandled Promise rejection: Template parse errors:
More than one component matched on this element.
Make sure that only one component 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"): class18@30:0 ; Zone: <root> ; Task: Promise.then ; Value: 

He speaks class2and class6. I cannot find out the original class names.

Here is my module definition:

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);
});

The parts indicated in ...mean more than one and the same.

How to understand which class zone.jsbelongs?

+4
source share
1 answer

Let's say we have the following application:

app.component.js

app.AppComponent = Component({
  selector: 'my-app',
  template:
    '<h1>(es5) angular2 4.1.3</h1><comp1></comp1>'
})
.Class({
  constructor: function AppComponent() {}
});

component1.js

app.Component1 = Component({
  selector: 'comp1',
  template:
    'component1'
})
.Class({
  constructor: function Component1() {}
});

component2.js

app.Component2 = Component({
  selector: 'comp1',
  template:
    'component2'
})
.Class({
  constructor: function Component2() {}
});

https://plnkr.co/edit/AKBVbX9ruZM8DchFcfbh?p=preview

So my actions are:

enter image description here

+5
source

Source: https://habr.com/ru/post/1679438/


All Articles