2016-12-30 82 views
0

鑑於我已經使用innerhtml.bind來插入一些html,但該html包含在它內部它是自己的aurelia'.bind'語句你如何獲得這些內部綁定被aurelia識別?Aurelia沒有綁定innerHTML綁定語句

例如

<div innerhtml.bind="myhtml"></div> 

其中

var myhtml = "<div click.trigger='console.log(123)'>some text</div>"; 

回答

2

docs說:

使用的innerHTML簡單綁定屬性設置元素的 innerHTML屬性。標記不通過Aurelia的模板系統 。 綁定表達式和要求元素不會被 評估。

如何創建組件並使用插槽?

我-component.html

<template> 
    <div><slot></slot></div> 
</template> 

consumer.html

<require from="./my-component.html"></require> 
<my-component><div click.trigger='console.log(123)'>some text</div></my-component>