Skip to content

NG0912 warning generated about collision detected #53

@AStrelkov

Description

@AStrelkov

I must be doing something wrong, because I keep getting this warning from Angular (ver. 20.3.6):

_NG0912: Component ID generation collision detected. Components '_CuteIcon' and 'CuteIcon2' with selector 'cute-icon' generated the same component ID. To fix this, you can change the selector of one of those components or add an extra host attribute to force a different ID. Find more at https://v20.angular.dev/errors/NG0912.

I try to insert a component from my library to markdown text as the following example:

## Usage
...
...
In the next line I try to display Bootstrap's icon as an example:

<cute-icon-ex>grid</cute-icon-ex>
...

In my AppConfig I add the following to providers array:

    ...
    provideDynamicHooks({
      parsers: [
        {
          component: CuteIcon,
          selector: "cute-icon-ex" // with just 'cute-icon' i get the same result
        }
      ]
    })
    ...

CuteIcon component has the selector name "cute-icon" in its decorator object.

Excerpt from my work.component.ts:

    protected parsedContent = signal<string>("");

    constructor() {

        this.contentChanged.pipe().subscribe((value) => {   
           ... 
           // the 'content' was parsed before with Marked.js library
           firstValueFrom( this._dynamicHookService.parse(content) )
              .then(result => {

                this.parsedContent.set(result.element.innerText);  // ???
                this.markForCheck();  
              };
        });
   }

And finally the work.component.html:

<ngx-dynamic-hooks [content]="parsedContent() | safe:'html'">
</ngx-dynamic-hooks>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions