diff --git a/src/app/shared/truncatable/truncatable.component.html b/src/app/shared/truncatable/truncatable.component.html index 1a778d1ea6..7b5c540a50 100644 --- a/src/app/shared/truncatable/truncatable.component.html +++ b/src/app/shared/truncatable/truncatable.component.html @@ -1 +1,2 @@ - \ No newline at end of file + +{{print(styles)}} \ No newline at end of file diff --git a/src/app/shared/truncatable/truncatable.component.ts b/src/app/shared/truncatable/truncatable.component.ts index cec9c287ac..ab4ca21b71 100644 --- a/src/app/shared/truncatable/truncatable.component.ts +++ b/src/app/shared/truncatable/truncatable.component.ts @@ -11,16 +11,22 @@ import { NativeWindowRef, NativeWindowService } from '../window.service'; selector: 'ds-truncatable', templateUrl: './truncatable.component.html' }) -export class TruncatableComponent implements AfterViewChecked { +export class TruncatableComponent implements OnInit { @Input() lines: Observable; @Input() innerHTML; @Input() height: Observable; + styles: any; public constructor(private elementRef:ElementRef, @Inject(NativeWindowService) private _window: NativeWindowRef) { } - ngAfterViewChecked(): void { + ngOnInit(): void { const lineHeight = this._window.nativeWindow.getComputedStyle(this.elementRef.nativeElement).lineHeight.replace('px', ''); + this.styles = this._window.nativeWindow.getComputedStyle(this.elementRef.nativeElement); this.height = this.lines.map((lines) => (lines * lineHeight)).startWith(0); - this.height.subscribe((h) => console.log('height: ', h)); + this.print(this.styles); + } + + print(styles) { + console.log(styles); } }