2017-08-15 105 views

回答

0

您可以手動設置爲跟隨,

比方說,你有一個在home.component.css稱爲home.component.ts

@Component({ 
    moduleId: module.id, 
    selector: 'home', 
    styleUrls: ['home.component.css'], 
    templateUrl: 'home.component.html', 
)} 

所以組件,您可以設置它的高度和下面的寬度,

:host {    // host targets selector: 'home' 

    display: block; 
    left: 0; 

    width: 100%; // takes parent width   
    OR  
    widht: 1000px // screen of having 1000px of width 


    height: 100%; // takes parent height  
    OR   
    height: 1000px // screen of having 1000px of height 
} 
+0

對不起,先生,請再幫我一個忙。如果我通過ngFor呈現組件。我的舊組件仍然有舊尺寸,我的新組件也有這個尺寸。因爲我的新組件無法在html中顯示。請幫我做元件沒有尺寸,只有元件裏面有。非常感謝 – BaoBao

+0

@寶寶。發生了什麼? – micronyks

+0

我完全無法理解您的問題。 – micronyks

相關問題