underscore _.range() not work at AngularJS ng-repeat
angularjs, underscore.js
Solution
If you want to use undersore's functions in your template you will have to expose it on a scope. If you want to have it available in all templates one way of doing so would be:
var app = angular.module('angularjs-starter', []);
app.run(function($rootScope){
$rootScope._ = _;
});
Then you could use it in a template as you've tried:
<div ng-repeat="item in _.range(20)">{{item}}</div>
Here is a working plunk: http://plnkr.co/edit/1Va4EikvRyFiQvhb2HYV?p=preview
While the above works it shouldn't be used. Model should be initialized in a controller. Otherwise AngularJS will execute `_range` on each $digest cycle to generate a new array.
Problem
If I want only 20 iteration, how can I repeat my block? It isnt work: ``` <div ng-repeat="item in _.range(20)"></div> ``` UnderscoreJS included in the page