I have this controller
angular
.module("ngCribs").controller("cribsController", function ($scope, cribsFactory) {
$scope.cribs = cribsFactory.getCribs();
});
and this factory
angular.module("ngCribs")
.factory("cribsFactory", function (){
var cribsData = [
{
type: "Apartamento",
price: 22000,
andress: "Estrada do Nagao",
description: "Casa excelente, 4 quartos"
},
{
"type": "Casa",
price: 320.000,
andress: "Centro, Mogi",
description: "Casa excelente, 2 quartos"
},
{
"type": "Apartamento",
price: 18000,
andress: "Cesar De Souza",
description: "Casa excelente, 4 quartos"
}
];
function getCribs() {
return cribsData;
}
return {
getCribs: getCribs()
};
});
The error is to call the getCribs of the message that it is not a function
Error Error: cribsFactory.getCribs is not a function