1
$scope.fetchData = function (param) {
var url = param;
var thumb;
var imgid = get_numbers(url);
var hash = ("http://vimeo.com/api/v2/video/" + imgid + ".json");
$http({
method: 'GET',
url: hash
}).then(function successCallback(response) {
thumb = response.data[0].thumbnail_medium;
}, function errorCallback(response) {
console.log("Request fail");
});
return thumb;
};
function get_numbers(input) {
return input.match(/[0-9]+/g);
}
var imgthumb = $scope.fetchData("http://player.vimeo.com/video/219839519");
alert(imgthumb);
Example: when I do console.log of the Thumb variable inside the function then, I can see the value of the variable, but when I return the value of the variable and undefined.
Colleague, describe your problem better and format your code.
– Bruno
Catch what? Where?
– Aline