title: How can I check whether array of objects is empty or not?
body: <pre><code>var app = angular.module('app',['ui.bootstrap']);
  
  app.controller("ListCtrl", function ($scope, $http) {
  
      $scope.submit = function () {
          $scope.loading = true;
          $scope.error = false;
          $http.get('http://www.omdbapi.com/?s=' + $scope.search + '&amp;r=json')
                 .then(function (res) {
                      var titles = [];
                      angular.forEach(res.data.Search, function(item){
                         $http.get('http://www.omdbapi.com/?t=' + item.Title + '&amp;y=&amp;plot=full&amp;r=json').then(function(res){
                         if (res.data.Poster === "N/A") {
                           res.data.Poster = "http://placehold.it/350x450/FF6F59/FFFFFF&amp;text=Image+not+Available!!";
                         }
                          titles.push(res.data); 
                        });  
                      });
  
                     $scope.movie = titles;
                     $scope.results = true;
                     $scope.error = false;
                     $scope.loading = false;
  
  
                     if (titles.length==0) {           // not working
                         $scope.results = false;
                         $scope.error = true;
                     }
  
  
                 })
  </code></pre>
  
  <p>I have been tried several things like :  </p>
  
  <pre><code>Object.getOwnPropertyNames(titles).length === 0) 
  obj == null 
  </code></pre>
  
  <p>None of them seems to work...</p>