I can’t get the value of an object inside an ARRAY

Asked

Viewed 159 times

0

I am developing an application to read a wordpress base. I have many posts that are separated by category.

I’ve been able to show the categories in the view but when I select a specific category it shows all the photos from all categories.

I am attaching two images to better explain the console.

inserir a descrição da imagem aqui inserir a descrição da imagem aqui

The first search was simple because it was picked up by the JSON API by the categories but when I click on one I’m lost. It follows the codes.

I really need your help. I work with children with ALS (Lateral Amyotrophic Exclerosis). This project has the function of uniting people with this problem.

Code that takes categories and list:

<blink> 
    $ionicLoading.show({template: 'Carregando...', duration: 3000});
    $http.get('localhost/app/api/get_tag_posts/…{ 
        $scope.lista = data; 
        console.log(data); 
        $ionicLoading.hide(); 
    }).error(function(erro){ 
        console.log(erro); 
        $ionicLoading.hide(); 
    }); 
</blink>

Then I’ll take a div and show you:

<div class="card" ng-repeat="pega in lista.posts"> </BR> 
    <a href="#/app/search" ng-click="obras($index)">
        <img src="{{pega.thumbnail}}" width="300" height="200"> 
    </a> 
    <h4> {{pega.title}} </h4> 
</div>

Here’s the problem, because when I choose the category I have to take the images inside this research and it’s showing me everything:

<div class="card" ng-repeat="pega in lista.posts"> 
    <div ng-repeat="pega2 in pega.attachments"> 
        <div class="Item item-text-wrap"> 
            <img src="{{pega2.url}}" width="100%"> <p></p> 
            <a class="button button-small button-outline button-positive" ng-click="Compartilhar($index)">Compartilhar...</a> <p></p> </br> 
        </div> 
    </div> 
</div>
  • 1

    Hello Roger, you can put the code that lists the categories and what it comes to when this category is selected?

  • Thanks for the help I’ll try to put here. I don’t know how to insert image again. I’m trying

  • You can paste the code, select it and press CTRL+K to indent.

  • When I press CTRL+K it opens the browser to search. I can’t. I’m sorry. Please help me.

  • Instead of pressing CTRL+K, try to select the whole text when you paste in the edit and click on the key icon { }.

  • Code that takes categories and list <Blink> $ionicLoading.show({template: 'Loading...', Duration: 3000}); $http.get('http://localhost/app/api/get_tag_posts/?tag_slug=Cibelle-costa'). Success(Function(data){ $Scope.list = data; console.log(data); $ionicLoading.Hide(); }). error(Function(error){ console.log(error); $ionicLoading.Hide(); }); </Blink?

  • then I take a div and show <div class="card" ng-repeat="picks up in list.posts"> </BR> <a href="#/app/search" ng-click="works($index)"><img src="{handle.thumbnail}}" width="300" height="200"</a> <H4> {handle.title}} </H4> </div>

  • Here is the problem because when I choose the category I have to pick up the images inside this search and it’s showing me everything <div class="card" ng-repeat="pick up in list.posts"> <div ng-repeat="pega2 in attachments.ments"> <div class="Item-text-wrap"> <img src="{pega2.url}}" width="100%"> <p></p> <a class="button button-small button-Outline button-Positive" ng-click="Share($index)">Share...</a> </p> </br> </div> </div> </div>

  • sorry but I couldn’t put it any other way. I really appreciate your help.

  • I noticed you’re using the same variable name 2x, which is the pega, is she not giving conflict? tries to change one of ng-repeat to see pega3 to see if it works.

  • didn’t work. How do I query an array that is inside another array via the Dice I have? Can you pass me a code from it please?

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.