How Displlay elements from API query , or put them in array

273 Views Asked by At

Hello i want to display results from https://developer.edamam.com/edamam-docs-recipe-api this api or to put them into array

vm.search = function(){
  var req2 = {
      method: "GET",


    url:"https://api.edamam.com/search?q="+vm.searchText+"&app_id=myID&app_key=myKey"


  }
  $http(req2).then(
      function(resp){
        console.log(resp);
        vm.recepti = resp.data.Search;
        console.log(vm.recepti);


      }, function(resp){
          vm.message = 'error';
      });

};

i dont quite understand this particular api, or how do i display all recepies (names, images and other parameters that it has) from query result that users inputs in field with vm.searchText text box thanks for help in advance

vm.recepti is an emtpy array ,

enter image description here when i go to query link i get this now how do i access properties based on this?

1

There are 1 best solutions below

2
On BEST ANSWER

Try to do something like this:

vm.recepti = resp.data.hits;