Skip to content

Commit

Permalink
Badge Fixed for Custom Components
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Dec 10, 2020
1 parent 617ed27 commit 815ad58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/app/components/badge/badge.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

.p-overlay-badge {
position: relative;
display: inline-block;
}

.p-overlay-badge .p-badge {
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/badge/badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class BadgeDirective implements AfterViewInit, OnDestroy {

ngAfterViewInit() {
this.id = UniqueComponentId() + '_badge';
let el = this.el.nativeElement.nodeName.indexOf("-") != -1 ? this.el.nativeElement.firstChild : this.el.nativeElement;

let badge = document.createElement('span');
badge.id = this.id ;
Expand All @@ -41,8 +42,8 @@ export class BadgeDirective implements AfterViewInit, OnDestroy {
DomHandler.addClass(badge, 'p-badge-dot');
}

DomHandler.addClass(this.el.nativeElement, 'p-overlay-badge');
this.el.nativeElement.appendChild(badge);
DomHandler.addClass(el, 'p-overlay-badge');
el.appendChild(badge);

this.initialized = true;
}
Expand Down

0 comments on commit 815ad58

Please sign in to comment.