【发布时间】:2018-07-17 14:42:04
【问题描述】:
考虑以下情况。
父组件:
<div title="title1">
<my-component input="title2"></my-component>
<my-component></my-component>
</div>
我的组件:
<div [title]="input">ABC</div>
这里的问题是,第一个“ABC” div 将具有 "title2" 工具提示,而第二个将具有 MyComponent 的默认值作为 input,这将“覆盖”"title1" 工具提示而不是想要的。
如果没有收到“输入”,如何避免在 MyComponent 模板中设置“标题”?
【问题讨论】:
标签: angular angular2-components