AngularJS: How to get $http result as returned value of a function?
Inside my controller I need a function that takes a parameter and returned a URL from server. Something like this: $scope.getPoster = function(title) { return $http.get("http://www.omdbapi.com/?t=" + title + "&y=&plot=short&r=json"); }; And inside my view I need to pass the title this way and get result as src for ng-src : <div class="col-sm-6 col-md-3" ng-repeat="movie in movies"> <div class="thumbnail"> <img class="poster" ng-src="{{getPoster(movie.Title)}}" alt="{{movie.Title}}"> <div class="caption"> <h3>{{movie.Title}}</h3> <p>{{movie.Owner}}</p> </div> </div> </div> I know the HTTP