title: Angular http testing
body: <p>I have a fairly simple controller that gets a simple json list of objects ...</p>
  
  <pre><code>function ProductGroupsCtrl($scope, $http, $routeParams, sharedService, popupService) {
  
  $scope.list = null;
  $scope.selectedItem = null;
  $scope.selectedItemJsonString = '';
  
  $scope.selectItem = function (item) {
      $scope.selectedItem = item;
      $scope.selectedItemJsonString = JSON.stringify(item);
      //alert(JSON.stringify(item));
  };
  
  $scope.closePopup = function () {
      $scope.selectedItem = null;
      $scope.selectedItemJsonString = '';
  };
  
  // sharedService.prepForBroadcast($routeParams.anotherVar);
  
  $http({
      method: 'GET',
      url: '/ProductGroup'
  }).success(function (data) {
      $scope.list = data;
  }).
  error(function (data) {
      $scope.message = 'There was an error with the data request.';
  });
  
  }
  </code></pre>
  
  <p>I then try to mock the request in the test class:</p>
  
  <pre><code>var scope, ctrl, $httpBackend, sharedServiceMock = {}, popupServiceMock = {};
  
  beforeEach(inject(function (_$httpBackend_, $rootScope, $controller) {
      $httpBackend = _$httpBackend_;
  
      $httsypBackend.expectGET('/ProductGroup').
      respond([{
          ProductGroupID: 5,
          MenuTitle: "Promotional Products",
          AlternativeText: "Coming soon - a collection of environmentally friendly Promotional Products",
          OrdinalPosition: 5,
          Active: false
      }]);
  
  
      scope = $rootScope.$new();
      ctrl = $controller(ProductGroupsCtrl, {
          $scope: scope,
          $http: $httpBackend,
          sharedService: sharedServiceMock,
          popupService: popupServiceMock
      });}));
  </code></pre>
  
  <p>However I receive an error in the testacular window <code>object undefined</code>. What have I done wrong here?</p>