I want a $http call in a custom filters that returns a value its not working(Asynch) and not returning a value.i want to do it by filters only.is it possible;
Here is my code:
.filter('getSportName', ['$http', '$filter','BASE_URL','$rootScope','adapter',function ( $http, $filter,BASE_URL,$rootScope,adapter) {
return function(id){
var request = {
method: 'get',
command: 'SportsMasters/'+id,
};
adapter.call(request)
.then(function (data) {
var selectedSport = data;
var name=data.sportstitle;
return name;
})
.catch(function (err) {
console.log(">>>>>>>error ",err);
})
}
}])
Thanks.