I encountered an error while performing a post from my controller.
function postDashboardsData (dataType, dateFrom, dateTo) {
$scope[dataType + '_done'] = false;
Api.post('rotations/' + vm.data[0]._id + '/dashboard', angular.extend({
type : dataType,
date_range : {
from : dateFrom,
to : dateTo
}
}, vm.data));
}
Next, I invoke the above function in the same controller.
postDashboardsData('overall', $scope.datepickerConf1.overall, $scope.datepickerConf2.overall)
.then(function(data) {
console.log('data>>>', data);
$scope.overallData = data;
})
The 'then' in the above code is causing it to return undefined.
Another error message appears:
TypeError: Cannot read property 'then' of undefined
What steps should I take to resolve this issue?