[英]Generate HTML using Javascript and then interpret it with Angular js
I'm generating an HTML table which renders like this: 我正在生成一个HTML表格,呈现如下:
<table id="#webappname">
<tr ng-repeat="data in d">
<td>1 {{data}}</td>
<td>2 hey !</td>
</tr>
</table>
To generate this i'm using angular.element("#webapp").append("<table [...]</table>");
要生成这个我使用
angular.element("#webapp").append("<table [...]</table>");
I would want the angular js template in the table to be interpreted by Angular (a little bit like jQuery.live()
). 我希望表中的角度js模板由Angular解释(有点像
jQuery.live()
)。 What should I use ? 我该怎么用?
var table = angular.element("<table [...]</table>");
$compile(table)($scope);
angular.element("#webapp").append(table);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.