Tab*_*med 11 angular angular4-forms
我有一些基本上为其设计的自定义指令<input>.我有一个自定义组件<app-decorated-input>
有一吨<app-decorated-input>用简单的一起小号<input>在我对其中一些我喜欢用指令的应用和为别人我不知道.如何使用指令<input>时如何将指令传递给底层:
<app-decorated-input directive1 directive2 ></app-decorated-input>
Run Code Online (Sandbox Code Playgroud)
并且对底层的指令具有相同的效果,<input>就像它直接在它上面使用一样:
<input type="text" directive1 directive2 >
Run Code Online (Sandbox Code Playgroud)
<app-decorated-input>除了它包含<input>我已经提到过的事实之外,里面的内容并没有多大意义.它的模板看起来类似于:
<div> Some decorations here </div>
<div>
<input type="text" {...directives}> <!-- In ReactJS this is done by using {...this.props} -->
</div>
<div> Some decorations here too! </div>
Run Code Online (Sandbox Code Playgroud)
我想做的就是将指定的所有指令转移<app-decorated-input>到底层<input>.
In the constructor of the directive you can do some like.
constructor(
@Attribute('attributeName') private attributeUno:String,
private element:ElementRef
) {
console.log(this.attributeUno);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
803 次 |
| 最近记录: |