I need to dynamically compile html and pass it from function as text. So, I have this code (simplified version for debugging purpose):
angular.module('app', [])
  .run(function($rootScope, $compile){
    var data = ["1","2"];
    var html  =
        '<div>' +
        '<ul>' +
        '<li ng-repeat="score in data">{{score}}</li>' +
        '</ul>'+
        '</div>';
    var el = angular.element(html);
    $rootScope.data = data;
    var result = $compile(el)($rootScope);
    console.log(result.html());
  })
The result is only:
<ul><!-- ngRepeat: score in data --></ul> 
So, it looks like ngRepeat does not "repeat" "li" element.
Why?
JsFiddle: http://jsfiddle.net/yoorek/K4Cmk/
(I know DOM manipulation should be in directive etc. and I know how to do it other way but I need to understand why this does not work)
 
     
     
     
    
– chourn solidet Nov 12 '16 at 03:34