I'm developing an Ionic mobile app and getting stuck by mistake
TypeError: t.getCases (...) and then not a function
The following is the information about my controller and service:
Service
starter.services.factory('appData', function() {
return {
getCases: function() {
var cases =[
{case_id: 1, description: 'headache'},
{case_id: 2, description: 'fever'},
{case_id: 3, description: 'stomachache'}
];
return cases;
}
}
})
Controller
starter.controllers.controller('mainViewCtrl', function($scope, appData) {
appData.getCases().then(function(data){
$scope.cases = data.cases;
});
console.log("mainViewCtrl completed");
})
Note that I run a gulp script to merge and uglify all JS files before creating the package file.
Any help would be greatly appreciated.
source
share