There are two almost the same functions. First function executes get().
function sendGet(url, $http) {
$http
.get(url)
.then(function() {
alert('Ok');
}, function() {
alert('Not Ok');
});
}
Second post().
function sendPost(url, $http) {
$http
.post(url)
.then(function() {
alert('Ok');
}, function() {
alert('Not Ok');
});
}
Is it possible to create more generic function which pass method get/post as a function parameter?
function sendGeneric(url, $http, methodCall) {
$http
.methodCall(url)
.then(function() {
alert('Ok');
}, function() {
alert('Not Ok');
});
}
If yes how to execute such function?