How to i handle when there is no response from api
service.js
app.factory('dropdownService', function ($http,CD_CONTEXT_VOLTAGE_URL) {
return {
getDropDownData: function (callback) {
$http.get(CD_CONTEXT_VOLTAGE_URL).success(callback);
}
}
});
controller.js
app.controller('loadDropDownController', ['$scope','dropdownService',function($scope,dropdownService) {
getFormData();
function getFormData() {
dropdownService.getDropDownData(function (results) {
$scope.contextlist = results.context;
$scope.cdlst = results.coordinationType;
$scope.voltageList = results.constraintValue;
});
};
}]);
The above code handles only success conditions.Could somebody help me with the code so that i can handle the error condition