I am new to using AngularJs and I have created a simple factory using $http get and it gets a .json that has a bunch or http status code numbers as keys, and their respective messages as values. I for some reason contine to get this error:
Cannot read property 'get' of undefined
json:
{
"200": "Ok",
"201": "Created",
"202": "Accepted",
"404": "Not_Found",
"400": "Bad Request",
"403": "Forbidden",
"417": "Expectation Failed"
}
factory.js
.factory('statusCodesFactory', function () {
var httpStatusCodes = {
getStatus: function ($http) {
$http.get('catalog/statusCodes.json')
.then(function (response) {
httpStatusCodes.code = response;
});
}
}
return httpStatusCodes;
})