我想就这个问题寻求帮助 . 我正在研究角度2和离子的动态组件:请检查下面的场景 .
我有组件名称按钮组件:
<button-component [label]="I'm a button" **small**></button-component>
small - 必须在按钮元素中动态输入,如 big , large .
在按钮组件视图文件里面我有:
<button "the single attribute must appear here like small">{{label}}</button>
输出将是 <button small>I'm a button</button>
我尝试了角度2中的所有属性绑定,但这是离子属性 .
如何使用离子2和角度2来执行此操作 . 通过动态使用单个属性属性 .
提前致谢 .
1 回答
与Angular 2相同,只需发送
size
属性并将其设置为small
然后在你的按钮组件中:
并在您的模板中:
并在CSS中声明所需的样式,例如: