title: Injecting Underscore.js into Angular Controller
body: <p>I tried two of the solutions <a href="https://stackoverflow.com/questions/14968297/use-underscore-inside-angular-controllers">here</a> to no avail.</p>
  
  <p>This is my Error:</p>
  
  <p><code>angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module flavorApplication due to:
  Error: [$injector:unpr] Unknown provider: underscore</code></p>
  
  <p>Here is my code for the module:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var underscore = angular.module('underscore', []);
  underscore.factory('_', ['$window', function() {
    return $window._;
  }]);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my App Config:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>(function(){
    angular.module("flavorApplication",
      ['ui.bootstrap',
          'ui.router',
          'angular-loading-bar',
          'angular-confirm',
          ]);
          angular.module("flavorApplication").config(['$stateProvider', '$urlRouterProvider', '$locationProvider', 
          'underscore', function ($stateProvider, $urlRouterProvider, $locationProvider, underscore){</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here I'm trying to inject it into a Controller (probably where I'm going wrong)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>(function () {
      'use strict';
  
      angular
          .module('flavorApplication')
          .controller('UsedSearchesController', UsedSearchesController);
  
      UsedSearchesController.$inject = ['$stateParams', '$state', 'DataService', '_'];
      function UsedSearchesController($stateParams, $state, DataService, _) {
          var vm = this;
          vm.currentSearches = $stateParams.search.split("|")
  
  
          activate(vm);
  
          ////////////////
  
          function activate(vm, _) {
              vm.removeSearch = function (searchTerm) {
                $stateParams.search =  _.filter(vm.currentSearches, 
                function(search){return search !== searchterm}).join("|")
                  $state.go('home');
              }
          }
      }
  })();</code></pre>
  </div>
  </div>
  </p>