Skip to content

Commit 2343c31

Browse files
committed
fix: use tag name to detect components
1 parent 85ed5b5 commit 2343c31

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

projects/design-angular-kit/src/lib/abstracts/abstract.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ export abstract class ItAbstractComponent implements AfterViewInit, OnChanges {
4444

4545
this.valueChanges = new EventEmitter<void>();
4646

47-
const name = this.constructor.name.replace('Component', '');
48-
let kebabName = name.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());
49-
kebabName = kebabName.replace('_-it-', '');
47+
const name = this._elementRef.nativeElement.tagName.toLowerCase().replace('it-', '');
5048
window['BOOTSTRAP_USED_COMPONENTS'] = window['BOOTSTRAP_USED_COMPONENTS'] ? window['BOOTSTRAP_USED_COMPONENTS'] : [];
51-
window['BOOTSTRAP_USED_COMPONENTS'].indexOf(kebabName) === -1 ? window['BOOTSTRAP_USED_COMPONENTS'].push(kebabName) : '';
49+
window['BOOTSTRAP_USED_COMPONENTS'].indexOf(name) === -1 ? window['BOOTSTRAP_USED_COMPONENTS'].push(name) : '';
5250
}
5351

5452
ngAfterViewInit(): void {

0 commit comments

Comments
 (0)