簡體   English   中英

具有未知html標簽的Angular 2(點擊)

[英]Angular 2 (click) with unknown html tags

(click)事件不會在模板的組件控制器上觸發:

<Shape *ng-for="#c of coords" inner-html="{{c.ts}}" 
    (click)="shapeSelected(t.subShapeID)"
    attr.shapeid="{{c.subShapeID}}" render="true" onmouseover="enter(this)" 
    onmouseout="leave(this)" isPickable="true">  </Shape>

Shape在這里是X3dom元素(沒有angular2組件)。

編輯:這適用於標准html標簽,例如

 <tr *ng-for="#t of coords" (click)="shapeSelected(t.subShapeID)">
                <td style="padding:0px 10px;">Shape</td>
                <td>{{t.subShapeID}}</td>
 </tr>

未知的html標簽怎么可能?

我猜控制台未在模板中定義。 嘗試在形狀組件中創建方法,該方法將執行console.log()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM