0

Why does the following piece of code:

angular.module('avafriqueWebApp')
  .service('MainService', function ($http) {

    var mainService = {
      getMenNewArrivals: getMenNewArrivals,
      getWomenNewArrivals: getWomenNewArrivals
    };
    return mainService;

    function getMenNewArrivals()
    {
      return $http.get('data/men-new-arrivals.json');
    }

    function getWomenNewArrivals()
    {
      return $http.get('data/women-new-arrivals.json');
    }

  });

all of a sudden return this error message:

enter image description here

I thought function hoisting in this fashion and crafting some type of interface was a good thing?

methuselah
  • 12,766
  • 47
  • 165
  • 315
  • 1
    Which part is not clear? – PM 77-1 Oct 14 '17 at 20:44
  • @PM77-1 this is a pattern I normally follow in my code. I am not sure why it is returning this error message all of a sudden – methuselah Oct 14 '17 at 20:44
  • Possible duplicate of [WHY JSLint complains: "someFunction() was used before it was defined"?](https://stackoverflow.com/questions/20786621/why-jslint-complains-somefunction-was-used-before-it-was-defined) – PM 77-1 Oct 14 '17 at 20:53

0 Answers0