title: Using underscore in Angular components
body: <p>This is a simplified version of the component I'm using:</p>
  <pre><code>things: Things[] = [...]
  
  addThing(thing: Thing) {
    // when using this.things =&gt; 'this' undefined!
  }
  
  addThings(things: Thing[]) {
    _.each(things, this.addThing);
  }
  </code></pre>
  <p>In short, I call <code>addThings</code> which at some point calls <code>addThing</code> for each individual <code>thing</code>. What am I doing wrong? Why is <code>this undefined</code> in <code>addThing</code>?</p>
  <p>I installed underscore in (what I think is) the usual way:</p>
  <pre><code>npm install --save-dev @types/underscore
  npm install --save underscore
  // angular.json:
  &quot;scripts&quot;: [
    ...,
    &quot;node_modules/underscore/underscore-min.js&quot;
  ]
  </code></pre>