与Angular2双向数据绑定类似,我有一个父组件和一个子组件.在父级中,我通过属性更改传递给子组件的值.孩子的财产被命名percentage.
https://gist.github.com/ideadapt/59c96d01bacbf3222096
我想将属性值绑定到html属性值.喜欢:<div style ="width:{{percentage}}%">.我没有找到任何有用的语法.所以我最终使用了一个更改侦听器来执行一些手动DOM更新:
this.progressElement = DOM.querySelector(element.nativeElement, '.progress');
DOM.setAttribute(this.progressElement, "style", `width: ${this.percentage}%`);
Run Code Online (Sandbox Code Playgroud)
是否有更优雅的方式来实现这一目标?
我有一个行布局,在根容器的第二个flex项中有一个嵌套的flex容器.我希望嵌套的flex容器是其父级的已用高度的100%.
<div class="steps root"><!--root container-->
<div class="step one">
I am very tall. Others should be as high as I am!
</div>
<div class="step two-and-three">
<div class="steps"><!--nested container-->
<div class="step two">
nested child 1. should have 100% vertical height
</div>
<div class="step three">
nested child 2. should have 100% vertical height
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是演示这个问题的小提琴:http://jsfiddle.net/2ZDuE/316/
如果我为嵌套的flex容器设置了显式高度,那么一切正常.
如何告诉嵌套容器自动填充其容器的垂直空间?