Skip to main content
deleted 2 characters in body
Source Link
br3w5
  • 4.6k
  • 6
  • 35
  • 42

You have syntax errors in how you're injecting the $http dependency into your factory that most likely are breaking the factory code. You are not currently including the factory method within the array where your dependencies are injected. There are also no quotation marks around $http and it's not being injected into the factory correctly (there is no $ symbol when it is passed as a param to the function). It should be:

angular
.module('dataLayerModule', [])
.factory('datalayer', ['$http', function ($http) {

    //some method in here that uses http request
    return factory;
}]);

Alternative syntax

With the syntax above (including dependencies and the function within an array), it can be difficult to spot these kinds of errors. An alternative and more explicit syntax is to pass the function name into the factory method and declare the function further down.

angular
    .module('dataLayerModule', [])
    .factory('datalayer', dataLayer);

dataLayer.$inject = ['$http'];

function dataLayer ($http) {

    //some method in here that uses http request
    return factory;
}

You have syntax errors in how you're injecting the $http dependency into your factory that most likely are breaking the factory code. You are not currently including the factory method within the array where your dependencies are injected. There are also no quotation marks around $http and it's not being injected into the factory correctly (there is no $ symbol when it is passed as a param to the function). It should be:

angular
.module('dataLayerModule', [])
.factory('datalayer', ['$http', function ($http) {

    //some method in here that uses http request
    return factory;
}]);

Alternative syntax

With the syntax above (including dependencies and the function within an array), it can be difficult to spot these kinds of errors. An alternative and more explicit syntax is to pass the function name into the factory method and declare the function further down.

angular
    .module('dataLayerModule', [])
    .factory('datalayer', dataLayer);

dataLayer.$inject = ['$http'];

function dataLayer ($http) {

    //some method in here that uses http request
    return factory;
}

You have syntax errors in how you're injecting the $http dependency into your factory that most likely are breaking the factory code. You are not currently including the factory method within the array where your dependencies are injected. There are also no quotation marks around $http and it's not being injected into the factory correctly (there is no $ symbol when it is passed as a param to the function). It should be:

angular
.module('dataLayerModule', [])
.factory('datalayer', ['$http', function($http) {

    //some method in here that uses http request
    return factory;
}]);

Alternative syntax

With the syntax above (including dependencies and the function within an array), it can be difficult to spot these kinds of errors. An alternative and more explicit syntax is to pass the function name into the factory method and declare the function further down.

angular
    .module('dataLayerModule', [])
    .factory('datalayer', dataLayer);

dataLayer.$inject = ['$http'];

function dataLayer($http) {

    //some method in here that uses http request
    return factory;
}
Alt syntax
Source Link
br3w5
  • 4.6k
  • 6
  • 35
  • 42

You have syntax errors in how you're injecting the $http dependency into your factory that most likely are breaking the factory code. You are not currently including the factory method within the array where your dependencies are injected. There are also no quotation marks around $http and it's not being injected into the factory correctly (there is no $ symbol when it is passed as a param to the function). It should be:

angular
.module('dataLayerModule', [])
.factory('datalayer', ['$http', function ($http) {

    //some method in here that uses http request
    return factory;
}]);

Alternative syntax

With the syntax above (including dependencies and the function within an array), it can be difficult to spot these kinds of errors. An alternative and more explicit syntax is to pass the function name into the factory method and declare the function further down.

angular
    .module('dataLayerModule', [])
    .factory('datalayer', dataLayer);

dataLayer.$inject = ['$http'];

function dataLayer ($http) {

    //some method in here that uses http request
    return factory;
}

You have syntax errors in how you're injecting the $http dependency into your factory that most likely are breaking the factory code. You are not currently including the factory method within the array where your dependencies are injected. There are also no quotation marks around $http and it's not being injected into the factory correctly (there is no $ symbol when it is passed as a param to the function). It should be:

angular
.module('dataLayerModule', [])
.factory('datalayer', ['$http', function ($http) {

    //some method in here that uses http request
    return factory;
}]);

You have syntax errors in how you're injecting the $http dependency into your factory that most likely are breaking the factory code. You are not currently including the factory method within the array where your dependencies are injected. There are also no quotation marks around $http and it's not being injected into the factory correctly (there is no $ symbol when it is passed as a param to the function). It should be:

angular
.module('dataLayerModule', [])
.factory('datalayer', ['$http', function ($http) {

    //some method in here that uses http request
    return factory;
}]);

Alternative syntax

With the syntax above (including dependencies and the function within an array), it can be difficult to spot these kinds of errors. An alternative and more explicit syntax is to pass the function name into the factory method and declare the function further down.

angular
    .module('dataLayerModule', [])
    .factory('datalayer', dataLayer);

dataLayer.$inject = ['$http'];

function dataLayer ($http) {

    //some method in here that uses http request
    return factory;
}
Source Link
br3w5
  • 4.6k
  • 6
  • 35
  • 42

You have syntax errors in how you're injecting the $http dependency into your factory that most likely are breaking the factory code. You are not currently including the factory method within the array where your dependencies are injected. There are also no quotation marks around $http and it's not being injected into the factory correctly (there is no $ symbol when it is passed as a param to the function). It should be:

angular
.module('dataLayerModule', [])
.factory('datalayer', ['$http', function ($http) {

    //some method in here that uses http request
    return factory;
}]);