Just two questions
1. ngRepeat will clone the template and then display each element in the array separately. So how does it do it? Is it to assign the scrope of each template instance to an array element?
2. How do I clone these templates and then dynamically bind the data binding, instructions and other things of the templates to them?
The repeat instruction watches the array (or object), and then loops through each item:
Use
$transclude
to get new content (already bound), and transclude will create a new scope, which is the scope used in repeat.You can find it in the source code of repeat https://github.com/angular/angular.js/blob/master/src/ng/directive/ngR...