3
如何设置div的高度等于窗口的高度?我已经在这个问题上Dynamically updating css in Angular 2我必须用下面的代码中发现:设置div的高度等于窗口的高度angular2
<div class="home-component"
[style.width.px]="width"
[style.height.px]="height">Some stuff in this div</div>
我已经更新此代码类似下面的代码:
<div class="imagecontainer" [style.height.px]="window.innerHeight">
Some code
</div>
但是,这给我一个错误:
Cannot read property
innerHeight
of undefined
我的问题,现在:
- 我如何设置
div
的高度等于Angular 2和TypeScript的内窗高度? - 我怎么能一次做到这一点,因为我必须这样做多个thimes?
我试图用'[style.height]',有没有一些文档,我可以指得到知道这些属性? –
@GiridharKarnik https://angular.io/docs/ts/latest/guide/template-syntax.html#!#style-binding – echonax