[英]How to access Angular 1.5 component property inside a template
我试图在Angular 1.5中实现一个简单的组件我试图访问组件mycomponentheader'中的绑定(绑定)属性'compTitle'。
var mycomponentheader = {
....
bindings: {
'comptitle': '@mycomptitle'
},
....
};
我在视图中的html标记中传递属性值[compTitle =“encryptedTitle”]。
<mycomponentheader mycomptitle="encryptedTitle">
<div>
This is displayed for component content
</div>
</mycomponentheader>
我尝试在指令中使用类似的机制。 相同的jsfiddle是@ https://jsfiddle.net/visibleinvisibly/4n7vsas7/
我知道将模板属性定义为可以在Angular 1.5中使用$ element和$ attrs(template:function($ element,$ attrs){}注入的函数,但我正在寻找其他方法。
提前致谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.