title: AngularJs: Error: [ng:areq] Argument 'fn' is not a function, got undefined
body: <p>guys!</p>
  
  <p>I am working on some Angular code from another person, and I am trying to figure stuff out. I updated libraries, using bower (because I needed some newer version to finish off the work) and I've got an error from Angular, on my homepage. The error is as follows: "Error: [ng:areq] Argument 'fn' is not a function, got undefined". I tried to debug it but no success. I also read a lot about it in here but nothing helped me. From what I've read the problem could be in the app .config() or in a wrongly declared controller, or ... who knows :D</p>
  
  <p>If you'd like to try and help me, I will provide important (in my opinion) bits of code:</p>
  
  <p>1) App configuretion:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>'use strict';
  var agencySeekApp = angular.module('agencySeekApp', ['ngResource', 'ngRoute', 'flang', 'ngCookies', 'agencySeekFilters'])
        .value('toastr', toastr)
        .config(function($routeProvider, $locationProvider) {
          $locationProvider.html5Mode({
            enabled: true,
            requireBase: false
          });
  
          var routeUserChecks = {
            adminRole: {
              authenticate: function(auth) {
                return auth.isAuthorizedForRole('admin');
              }
            },
            authenticated: {
              authenticate: function(auth) {
                return auth.isAuthenticated();
              }
            }
          };
  
          $routeProvider
            .when('/', {
              templateUrl: '/app/views/home.html',
              controller: 'HomePageCtrl'
            })
            .when('/category/:categoryId/choose-network/', {
              templateUrl: '/app/views/network_pick.html',
              controller: 'ChooseNetworkCtrl'
            })
            .when('/category/:categoryId/network/:networkId', {
              templateUrl: '/app/views/schools_pick.html',
              controller: 'SchoolPageCtrl'
            })
            .when('/agencies/:categoryId/:schoolId', {
              templateUrl: '/app/views/agency.html',
              controller: 'AgencyPageCtrl'
            })
            .when('/show/agency/:agencyId', {
              templateUrl: '/app/views/agency_show.html',
              controller: 'ShowAgencyCtrl'
            })
            .when('/show/school/:schoolId', {
              templateUrl: '/app/views/school_show.html',
              controller: 'ShowSchoolCtrl'
            })
            .when('/case/open', {
              templateUrl: '/app/views/open_case.html',
              controller: 'OpenCaseCtrl'
            })
            .when('/case/show/:case_id', {
              templateUrl: '/app/views/show_case.html',
              controller: 'ShowCaseCtrl'
            })
            .when('/account/retrivePassword', {
              templateUrl: '/app/views/account.html',
              controller: 'AccountPageCtrl'
            })
            .when('/search/:search_params',{
              templateUrl: '/app/views/search_page.html',
              controller: 'SearchPageCtrl'
            }).when('/postcode-agencies/category/:categoryId/postcode-id/:postCodeId',{
              templateUrl: '/app/views/post_code_agencies.html',
              controller: 'PostCodeAgenciesCtrl'
            })
          /*for delete*/
            .when('/sysadmin/network',{
              templateUrl: '/app/views/sys_admin_network.html',
              controller: 'SysAdminNetworkCtrl'
            })
            .when('/sysadmin/categories',{
              templateUrl: '/app/views/sys_admin_categories.html',
              controller: 'SysAdminCategoriesCtrl'
            })
            .when('/sysadmin/list',{
              templateUrl: '/app/views/sys_admin_list.html',
              controller: 'SysAdminListCtrl'
            })
            .when('/sysadmin/users',{
              templateUrl: '/app/views/sys_admin_users.html',
              controller: 'SysAdminUsersCtrl'
            })
          /*end*/
          /*account*/
            .when('/account/cases',{
              templateUrl: '/app/views/account_cases.html',
              controller: 'AccountCasesCtrl'
            })
            .when('/account/teachers',{
              templateUrl: '/app/views/account_teachers.html',
              controller: 'AccountTeachersCtrl'
            })
            .when('/account/schools',{
              templateUrl: '/app/views/account_schools.html',
              controller: 'AccountSchoolsCtrl'
            })
            .when('/account/agencies',{
              templateUrl: '/app/views/account_agencies.html',
              controller: 'AccountAgenciesCtrl'
            })
            .when('/account/case_workers',{
              templateUrl: '/app/views/account_councilors.html',
              controller: 'AccountCouncilorsCtrl'
            })
            .when('/account/linking',{
              templateUrl: '/app/views/account_linking.html',
              controller: 'AccountLinkingCtrl'
            })
            .when('/account/handshaking',{
              templateUrl: '/app/views/account_handshaking.html',
              controller: 'AccountHandshakingCtrl'
            })
            .when('/account/myprofile',{
              templateUrl: '/app/views/my_profile.html',
              controller: 'AccountProfileCtrl'
            })
            .when('/account/report',{
              templateUrl: '/app/views/account_report.html',
              controller: 'AccountReportCtrl'
            })
            .when('/account/admin-settings', {
              templateUrl: '/app/views/account_admin_settings.html',
              controller: 'AccountAdminSettingsCtrl'
            })
  
          /*end*/
            .otherwise({
              templateUrl: '/app/views/home.html',
              controller: 'in_Otherwise'
            });
        });</code></pre>
  </div>
  </div>
  </p>
  
  <p>2) Homepage controller: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>angular.module('agencySeekApp')
    .controller('HomePageCtrl',['$scope','identity','$http','selectedSchoolCookieService',function($scope,identity,$http,selectedSchoolCookieService){
      //$scope.test = 'some test';
      $scope.identity = identity;
      $http.get('/api/v1/agency/categories')
        .success(function(res){
          console.log("res : ",res);
          $scope.arr = res.data;
        })
        .error();
  
      var url = '';
      var schoolIdCookie = selectedSchoolCookieService.getCookie('schoolId');
      $scope.urlForTheUser = function (someId) {
        if(identity.currentUser &amp;&amp; identity.currentUser.isFromSchool() ){
          url = '/agencies/'+someId+'/'+identity.currentUser.school_id+'/';
        }else {
          if(schoolIdCookie) {
            url = '/agencies/' + someId + '/' + schoolIdCookie;
          }else {
            url = '/category/'+someId+'/choose-network/';
          }
        }
        return url;
      };</code></pre>
  </div>
  </div>
  </p>
  
  <p>3) The scripts section from my index.html, including all the scripts (for inclusion order reference):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script type="text/javascript" src="/lib/jquery/dist/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/charts/jquery.flot.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/charts/jquery.flot.pie.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/charts/jquery.flot.spline.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/jRate-master/dist/jRate.min.js"&gt;&lt;/script&gt;
  
  &lt;script type="text/javascript" src="/lib/angular/angular.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/bootstrap/dist/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/toastr/toastr.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/angular-resource/angular-resource.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/angular-route/angular-route.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/angular-cookies/angular-cookies.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/lib/angular-sanitize/angular-sanitize.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/flangCharts.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/app.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/custom.js"&gt;&lt;/script&gt;
  
  &lt;script type="text/javascript" src="/app/account/auth.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/identity.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/LoginController.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/usersResource.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/services/selectedAgencies.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/services/pageService.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/services/selectedSchoolCookieService.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/services/lastPageCategorySelected.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/directives/fileUploadDirective.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/directives/popUpAgencyDirective.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/directives/popUpLinkingDirective.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/directives/reportDirectives.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/filters.js"&gt;&lt;/script&gt;
  
  
  &lt;script type="text/javascript" src="/app/controllers/HomePageCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/ChooseNetworkCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/ShowAgencyCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/SchoolPageCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/AgencyPageCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/ShowAgencyCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/OpenCaseCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/SearchPageCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/ShowCaseCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/ShowSchoolCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/LeftSideBarCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/PostCodeAgenciesCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/controllers/AccountAdminSettingsCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/SysAdminNetworkCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/SysAdminListCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/SysAdminUsersCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/SysAdminCategoriesCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountCasesCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountTeachersCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountSchoolsCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountAgenciesCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountCouncilorsCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountLinkingCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountMenuCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountHandshakingCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountProfileCtrl.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/app/account/user_page_ctrl/AccountReportCtrl.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Hope that is enough!</p>
  
  <p>Best regards,
  H.</p>