How to specify model to a ngInclude directive in AngularJS?

There is a rather simple solution, although I must admit, it’s not what Misko would recommend. But if creating a directive is an overkill for you and getting Brice’s patch is not feasible then the following will help you.

<div ng-repeat="name in ['A']" ng-include="'partial.html'"></div>
<div ng-repeat="name in ['B']" ng-include="'partial.html'"></div>

<script type="text/ng-template" id="partial.html">
   <div>{{ name }}</div>
</script>

It’s quite evident why it works. See an example here: http://jsfiddle.net/Cndc6/4/

Leave a Comment