ng-show
的 polymer 是否等效?这是我要转换的内容的片段示例:
<h1>Greeting</h1>
<div ng-show="authenticated">
<p>The ID is {{controller.greeting.id}}</p>
<p>The content is {{controller.greeting.content}}</p>
</div>
<div ng-show="!authenticated">
<p>Login to see your greeting</p>
</div>
最佳答案
dom-if
在这里不是必需的。只需使用 $=
(属性绑定(bind))添加/删除隐藏
属性。
<style>
[hidden] {
display:none;
}
</style>
<h1>Greeting</h1>
<div hidden$=[[!authenticated]]>
<p>The ID is {{controller.greeting.id}}</p>
<p>The content is {{controller.greeting.content}}</p>
</div>
<div hidden$=[[authenticated]]>
<p>Login to see your greeting</p>
</div>
使用 dom-if
决定您不想呈现的代码块,而不仅仅是隐藏。
关于angularjs - polymer 等同于 ng-show?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39004549/