2016-12-02 8 views

答えて

2

私が言うと思います:それはclientWidthで働い

<div #width1> 
<div [style.width.px]="width2"> 

export class MyComponent 
{ 
width1: number; 
@ViewChild('width1') width1; 


ngAfterViewInit(){ 
    this.width2 = this.width1.nativeElement. width - 30; 

    } 
} 
+0

WIDTH1は(ngAfterViewInitに定義されていません) – Dynamic

+0

:) – Dynamic

関連する問題