I am trying to use the omdbapi to gather movie information, and while I can retrieve data for valid movie titles, I want to display a message when the title entered does not exist. Can someone help me identify what is causing the issue in my code?
$scope.searchMovie= function(){
$http.get('http://www.omdbapi.com/?t='+$scope.name+'&y='+$scope.year+'').success(function (response) {
var len=response.length;
if(len === null)
{
alert("No records found!");
}
else{
$scope.movieSearch=response;
}
});
};