[英]AngularJS recursive ng-repeat variable binding with ng-include
[英]How to inject ng-repeat loop variable in ng-include content in angular
我想建立两个具有相同记录结构的表。 一个表是Main,另一个表是Archiv。 记录是具有col-sm-x结构的引导div,其中包含{{rec.Name}},{{rec.Age}}等。从记录内容中,我制作了一个tablerecord.html模板,我想在两种不同的情况下使用ng-repeat建立表格。
<div> ng-repeat="rec in MainTable"><record_template/></div>
and
<div> ng-repeat="rec in Archiv""><record_template/></div>
为了加载记录模板,我使用了角度指令“ recordTemplate”。 如何在record_template中注入“ rec”变量?
提前致谢。
您可以在指令组件中使用@input批注
https://angular.io/guide/attribute-directives#binding-to-an-input-property
As i don't know how you written your directive. you can check the below link.
http://jsbin.com/gopula/1/edit?html,js,output
and try this
<div> ng-repeat="rec in MainTable" record_template ="rec"/></div>
and
<div> ng-repeat="rec in Archiv" record_template="rec"/></div>
Hope this will help you
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.