Angular js- ng-repeat does not display the data correctly

0

I have a problem with this code. It turns out that I program the list as it is expressed in all the docs, the problem is that when I enter for the first time, I log in and enter that view the console.logs is executed but it is not seen in the screen, when I give it again to the button of the tab, if it looks .. like it is updated, but not the first one if it is in the controller? Any solution?

                        ARCHIVO dieta.html
<ion-view view-title="Dieta" >
<ion-content class="has-header">

<div class="list list-inset">
    <div ng-repeat='item in cena'>
    <div class="item list">
      {{cena}}
    </div>
    </div>
</div>



</ion-content>
</ion-view>

Fragment of the index.html

     <body ng-app="starter">
    <ion-nav-bar class="bar-assertive" ng-controller="LogoutCtrl">

    <ion-nav-buttons side="primary">
    </ion-nav-buttons>
    <ion-nav-buttons side="secondary">
            <a class="button button-clear ion-android-exit" ng-click="salir()">  salir</a>
    </ion-nav-buttons>
    </ion-nav-bar>

    <ion-nav-view></ion-nav-view>
    </body>

app.js

   .state('tab.dieta', {
    url: '/dieta',
    views: {
      'tab-dieta': {
        templateUrl: 'templates/dieta.html',
        controller: 'DietaCtrl'
      }
    }
  })


  .controller('DietaCtrl', function($scope){
        var Dieta = Parse.Object.extend("Dieta");

        var query = new Parse.Query(Dieta);
        query.equalTo("user", Parse.User.current().id);
        query.find({
          success: function(results) {

            var cena= [];


            for (var i = 0; i < results.length; i++) {
              var object = results[i];

              cena.push(object.get('cena'))

            }
            $scope.cena= cena

    },
    error: function(error) {
        alert("Error: " + error.code + " " + error.message);
    }
    });
    
asked by Julian Cabral 07.05.2016 в 01:43
source

0 answers