How to inject ng-repeat loop variable in ng-include content in angular

I want to build two table with same record structure. One table is Main, other table is an Archiv. The record is a bootstrap divs with col-sm-x structure with {{rec.Name}}, {{rec.Age}} etc. From the record content I made a tablerecord.html template and i want to use in two different ng-repeat to build tables.

<div> ng-repeat="rec in MainTable"><record_template/></div> 
<div> ng-repeat="rec in Archiv""><record_template/></div>

To load the record template I use angular directive "recordTemplate". How to inject "rec" variable in record_template?

Thanks in advance.

2 answers

  • answered 2017-06-17 18:05 Amr Alaa

    you can use the @input annotation in your directive component

  • answered 2017-06-17 18:05 Arun

        As i don't know how you written your directive. you can check the below link.
    and try this 
    <div> ng-repeat="rec in MainTable" record_template ="rec"/></div> 
    <div> ng-repeat="rec in Archiv" record_template="rec"/></div>
        Hope this will help you