0

I would like to write out list of some items in my app using ng-repeat but i faced with this problem:

Template

<ion-slide-box  on-slide-changed="slideHasChanged($index)" ng-controller="AccountCtrl" ng-init="getData()">
    <ion-slide   ng-repeat="statitem in stats">
        <div class="box vh80">
            <h1>{{statitem.name}}</h1>
            <h1>Test</h1>
        </div>
    </ion-slide>
</ion-slide-box>

And in AccountCtrl

angular.module('starter.controllers', [])
    .controller('AccountCtrl', function($scope, Friends) {

        $scope.getData = function() {

            console.log('test');
            var friends = [
                { id: 0, name: 'Scruff McGruff' },
                { id: 1, name: 'G.I. Joe' },
                { id: 2, name: 'Miss Frizzle' },
                { id: 3, name: 'Ash efe' }
            ];
            $scope.stats = friends;
         }
   });

Problem is, that no item is obtained in template.

Where can be problem please?

Thanks for any help.

EDIT:

I solved it by moving the method calling to the parent div.

<ion-content class="padding" ng-controller="AccountCtrl" ng-init="getData()">
0

2 Answers 2

1

try to clear the template a little bit to test to be sure that your HTML is 100% right, so you may make such this:

<div ng-controller="AccountCtrl" ng-init="getData()">
    <div ng-repeat="statitem in stats">
          <h1>{{statitem.name}}</h1>
    </div>
</div>

and if you see any results you have then you have to check your HTML and CSS template.

Sign up to request clarification or add additional context in comments.

Comments

0

I solved it by moving the method calling to the parent div.

<ion-content class="padding" ng-controller="AccountCtrl" ng-init="getData()">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.