I Have this AngularJS factory that's is working fine, However when i try to accommodate it in auto generated visual studio snippet for AngularJS factory, It does not happen and i can not get the syntax right.This is my factory
angular.module('payrollApp').factory('countries', function ($http) {
return {
getCountries: function (callback) {
$http.get('countries.json').success(callback);
}
}});
But how should i change it so i can use Visual Studio auto generated code. This is the auto generated snippet:
(function () {
'use strict';
angular
.module('app')
.factory('factory', factory);
factory.$inject = ['$http'];
function factory($http) {
var service = {
getData: getData
};
return service;
function getData() { }
}})();
Try this,
(function () {
'use strict';
angular
.module('payrollApp')
.factory('countries', factory);
factory.$inject = ['$http'];
function factory($http) {
var service = {
getCountries: getCountries
};
return service;
function getCountries(callback) {
$http.get('countries.json').success(callback);
}
}})();