title: AngularJs: Have Underscore/Lodash/_ in the view template
body: <p>I am trying to have the Underscore/Lodash/_ available in the AngularJS view template. This way I can use _ like shown below:</p>
  
  <pre><code>&lt;li ng-repeat="number in _.range(100, 125)"&gt;&lt;!-- Some logic here --&gt;&lt;/li&gt;
  </code></pre>
  
  <p>And for that matter, we can use any of those useful functions of Lodash.</p>
  
  <p>We can achieve this by just adding _ to the $scope of the controllers and directives as shown below:</p>
  
  <pre><code>$scope._ = _;
  </code></pre>
  
  <p>But I would like to have a one-time configuration/change that adds _ to every scope for every view templates.</p>
  
  <p>One approach I found useful is:</p>
  
  <pre><code>$rootScope._ = _; //Have this line in .run() method.
  </code></pre>
  
  <p>This works fine for all the views of controllers and directives.  But this is not working for views of isolated scoped directives.  I again have to add ($scope._ = _;) in the directive definition.</p>
  
  <p>Is there a one-time/single-place change/configuration/code that can achieve this?</p>
  
  <p>Note: The other question <a href="https://stackoverflow.com/questions/23862119/how-to-make-lodash-work-with-angular-js">How to make lodash work with Angular JS?</a> talks specifically about using lodash in ng-repeat.  But my question is about using lodash in every view template (including directive view template).  That is where I found an limitation with isolated scoped directive.</p>