title: Expected undefined to be defined How do i fix it
body: <p>I am trying to test my Angular with Jasmine but somehow i keep getting this error Expected undefined to be defined and i have followed that angular documentation example i am on mean stack</p>
  
  <p>test.js</p>
  
  <p>describe('Testing Ecdreport Controllers', function(){
      var $scope, controller;</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var app = angular.module('mean.ecdreport',[])
  .controller('EcdreportController', ['$scope', '$http', 'Global', 'Ecdreport', function($scope, $http, Global, Ecdreport) {
      $scope.global = Global;
      $scope.query = "";
      $scope.package = {
          name: 'ecdreport'
      };
      
  
              $scope.startDate = null;
              $scope.endDate = null;
              $scope.currentPage = 1;
              $scope.child= [];
              $scope.maxSize = 5;
              $scope.items = [];
              $scope.itemsPerPage = 10;
              $scope.totalItems = null;
              $scope.direction = 1;
              $scope.directionOld = 1;
              $scope.sortAttributes = 0;
              $scope.sortAttributesOld = 0;
              $scope.datamodel = null;
       
  
          $scope.getDataModel = function() {
             
              $http({url:'/api/v1/getdatamodel', method:"GET"})
                  .success(function(data) {
                      console.log('Datamodel successful');
                      $scope.datamodel = data[0];
                      console.log('datamodel', data);
                     
                  })
                  .error(function(error) {
                      $scope.datamodel =[];
                  });
          }
       //   console.log("Trying to get datamodel");
          $scope.getDataModel();
       });
                                      
                                      
                                      
     describe('Testing Ecdreport Controllers', function(){
   var $scope, controller;
  
   beforeEach(module('mean.ecdreport', function($controllerProvider){
     $controllerProvider.register('EcdreportController', function(){
     });
   }));
                                      
                                      
        beforeEach(inject(function(_$rootScope_,_$controller_){
     $scope = _$rootScope_.$new();
     controller = _$controller_('EcdreportController',
      {$scope : $scope
      });
    }));
   
   
   it('Should be registered', function(){
    expect(controller).toBeDefined();
   })
  
   it('Testing Scope', function(){
    expect($scope).toBeDefined()
    expect($Scope.getDataModel).toBeDefined();
   })
  
   
   
  });                                 
                                      
                                      
                                      
     </code></pre>
  </div>
  </div>
  </p>
  
  <pre><code>beforeEach(module('mean.ecdreport', function($controllerProvider){
      $controllerProvider.register('EcdreportController', function(){
      });
  }));
  
  
      beforeEach(inject(function(_$rootScope_,_$controller_){
          $scope = _$rootScope_.$new();
          controller = _$controller_('EcdreportController',
              {$scope : $scope
              });
      }));
  
  
  it('Should be registered', function(){
      expect(controller).toBeDefined();
  })
  
  it('Testing Scope', function(){
      expect($scope).toBeDefined()
  
      expect($scope.getDataModel).toBeDefined();
  })
  </code></pre>
  
  <p>});</p>