Ellipsis directive with title
问题 I have an Angular directive that adds styling text-overflow: ellipsis; overflow: hidden; white-space: nowrap; in ngOnInit and then looks something like this: @Directive({ selector: 'ellipsis' }) class EllipsisDirective { ngAfterViewInit() { const el: HTMLElement = this.el.nativeElement; if (el.offsetWidth < el.scrollWidth) { el.setAttribute('title', el.innerText); } } } Usage: <div ellipsis>Some Very Long Text Here</div> The problem: On some pages, the layout/components do not change on a