Small Bugfixes (#2414)

This commit is contained in:
Joe Milazzo 2023-11-08 12:38:44 -06:00 committed by GitHub
parent 26b0cb7d0c
commit b7e7eaf1a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 91 additions and 87 deletions

View file

@ -1,4 +1,13 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, Input, OnInit, TemplateRef } from '@angular/core';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ContentChild,
inject,
Input,
OnInit,
TemplateRef
} from '@angular/core';
import {CommonModule} from "@angular/common";
import {TranslocoDirective} from "@ngneat/transloco";
@ -12,6 +21,8 @@ import {TranslocoDirective} from "@ngneat/transloco";
})
export class BadgeExpanderComponent implements OnInit {
private readonly cdRef = inject(ChangeDetectorRef);
@Input() items: Array<any> = [];
@Input() itemsTillExpander: number = 4;
@ContentChild('badgeExpanderItem') itemTemplate!: TemplateRef<any>;
@ -24,8 +35,6 @@ export class BadgeExpanderComponent implements OnInit {
return Math.max(this.items.length - this.itemsTillExpander, 0);
}
constructor(private readonly cdRef: ChangeDetectorRef) { }
ngOnInit(): void {
this.visibleItems = this.items.slice(0, this.itemsTillExpander);
this.cdRef.markForCheck();