[英]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.