を変更するCSSクラスを追加取得する方法を、私は更新CSSクラスoffsetWidthとoffsetHeight値が後に彼らに
.slider-horizontal {
width: 210px;
height: 20px;
}
import {Component, OnInit, Input, ViewChild, ElementRef, Renderer} from '@angular/core'; export class SliderComponent implements OnInit { @ViewChild('picker') picker: ElementRef; constructor(private renderer: Renderer, private el: ElementRef) { } ngAfterViewInit() { this.renderer.setElementClass(this.picker.nativeElement, 'slider-horizontal', true); console.log(this.picker.nativeElement.offsetWidth);//old value console.log(this.picker.nativeElement.offsetHeight);//old value } }
どのようにしている新しい値を得るのですかコンポーネントを持っていますcssを適用した後に変更しましたか?
あなたの問題を示すプランナーを提供してください。 – micronyks