I want custom sync and async in angularjs like below.
var async = function (url, data, action, callback) {
$.ajax({
url: global.baseURL + url,
type: action,
data: data,
async: true,//or false
success: function (data) {
if (data !== undefined && data !== null) {
callback(data);
}
}
});
};
In AngularJs look like this code
$http({ method: 'GET', url: baseURL + 'Api/MobilePref/Get/'+uid
})
.success(function (data, status, headers, config) {
})
.error(function (data, status, headers, config) {
//TODO: handl error.
});
Can any one tell me how to setup sync and async call in angularjs?