title: AngularJS Error: $injector:unpr Unknown Provider githubProvider <- github <- MainController
body: <p>I'm trying to build my own service by following the example in the documentation for the factory methodology. I think I've done something wrong however because I continue to get the unknown provider error</p>
  
  <p>index.html</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
  &lt;html ng-app="githubViewer"&gt;
  
  &lt;head&gt;
    &lt;script data-require="angular.js@1.4.3" data-semver="1.4.2" src="https://code.angularjs.org/1.4.2/angular.js"&gt;&lt;/script&gt;
    &lt;link rel="stylesheet" href="style.css" /&gt;
    &lt;script src="script.js"&gt;&lt;/script&gt;
    &lt;script src="github.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  
  &lt;body ng-controller="MainController"&gt;
  
    &lt;div&gt;
      &lt;h1&gt;{{message}}&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div&gt;
      {{ error }}
    &lt;/div&gt;
    {{ countdown }}
    &lt;form name="searchUser" ng-submit="search(username)"&gt;
      &lt;input type="search" required placeholder="Username to find" ng-model="username"&gt;
      &lt;input type="submit" value = "search" &gt;
  
    &lt;/form&gt;
  
  
    &lt;div ng-include="userdetails" ng-show = "user"&gt;&lt;/div&gt;
  
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>script.js</p>
  
  <pre><code>    (function() {
  
    angular
      .module("githubViewer", [])
      .controller("MainController",MainController);
    //  .controller("MainController", 
    //  ["$scope", "github","$interval","$log","$anchorScroll","$location", MainController]);
  
    MainController.$inject = ["$scope", "$http","$interval","github"];
  
  
  
    function MainController($scope,github,$interval,$log,$achorScroll,$location) {
    //  var onUserComplete = function(response) {
    //    $scope.user = response.data;
    //    $http.get($scope.user.repos_url)
    //         .then(onRepos,onError)
    //  };
  
    var onUserComplete = function(data) {
        $scope.user = data;
       gethub.getRepos($scope.user).then(onRepos,onError)
      };
  
  
      var onRepos = function(data){
        $scope.repos = data;
        $location.hash("userDetails");
        $anchorScroll();
      };
  
      var onError = function(reason) {
        $scope.error = "could not display data" ;
  
      };
  
      $scope.search = function(username) {
        $log.info("searching for "+ username);
        github.getUser(username).then(onUserComplete, onError);
  
          if(countdownInterval){
            $interval.cancel(countdownInterval)
            $scope.countdown = null;
          }
  
      };
  
      var decrementCountdown = function(){
        $scope.countdown -= 1; 
        if($scope.countdown &lt; 1){
          $scope.search($scope.username)
        }
      };
      var countdownInterval = null;
      var startCountdown = function(){
        countdownInterval = $interval(decrementCountdown,1000,$scope.countdown);
  
      };
  
      $scope.username = "Angular";
      $scope.message = "GitHub Viewer!";
      $scope.repoSortOrder ="-stargazers_count";
      $scope.userdetails ="userdetails.html";
      $scope.countdown = 5;
      startCountdown();
    };
  
  })();
  </code></pre>
  
  <p>github.js</p>
  
  <pre><code>(function(){
  
    var github = function($http){
  
      var getUser = function(username){
        return $http.get("https://api.github.com/users/" + username)
                    .then(function(response){
                      return response.data;
  
                    });
  
      };
  
      var getRepos = function(user){
        return $http.get(user.repos_url)
                    .then(function(response){
                      return response.data;
  
                    });
      };
  
      return{
            getUser : getUser,
            getRepos ; getRepos
  
      };
    };
  
  
    var module = angular.module("githubViewer");
    module.factory("github",github);
  
  }());
  </code></pre>
  
  <p>console error :</p>
  
  <pre><code>Error: [$injector:unpr] Unknown provider: githubProvider &lt;- github &lt;- MainController
  http://errors.angularjs.org/1.4.2/$injector/unpr?p0=githubProvider%20%3C-%20github%20%3C-%20MainController
      at REGEX_STRING_REGEXP (angular.js:68)
      at angular.js:4264
      at Object.getService [as get] (angular.js:4411)
      at angular.js:4269
      at getService (angular.js:4411)
      at Object.invoke (angular.js:4443)
      at ident.$get.extend.instance (angular.js:9001)
      at nodeLinkFn (angular.js:8111)
      at compositeLinkFn (angular.js:7543)
      at compositeLinkFn (angular.js:7547)
  </code></pre>
  
  <p>Please point me to the right direction. </p>