title: AngularJS: TypeError: Cannot read property 'get' of undefined
body: <p>I am trying to use a service inside my angular controller, however I am getting the error in the <code>TypeError: Cannot read property 'get' of undefined</code>.</p>
  
  <p>This is how my <code>app.js</code> script look like:</p>
  
  <pre><code>angular
      .module('ToDoApp', ['ngAnimate', 'todoService'])
      .controller('ToDoController', ['$scope', function($scope, $http, Todo) {
  
          Todo.get()
              .success(function(data) {
                  $scope.tasks = data;
              });
          // ...
       }]);
  </code></pre>
  
  <p>It doesn't know about the <code>get</code> propery. This is how <code>Todo</code> looks like:</p>
  
  <pre><code>angular.module('todoService', [])
      .factory('Todo', function($http) {
          return {
              get: function() {
                  return $http.get('/todos');
              },
              // ...
          }
      });
  </code></pre>
  
  <p>And I'm loading the scripts in this order:</p>
  
  <pre><code>&lt;script src="{{ asset('/scripts/services/todoService.js') }}"&gt;&lt;/script&gt;
  &lt;script src="{{ asset('/scripts/app.js') }}"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>The error sounds to me like the controller isn't getting the service object correctly, like this dependency is missing. But I already loaded the dependency with the <code>module</code>.</p>
  
  <p>What am I missing?</p>