admin管理员组

文章数量:1336643

I'm trying to do a slider style page which presents dynamic data based on my json file given.

In my controller:

constructor(navController) {
   this.navController = navController;
   this.populateHistory();
}

populateHistory(){
  console.log("populating!");
   var tests = '{[{"name":"jack"},{"name":"john"},{"name":"joe"}]}';
}

In my html:

 <ion-slides>
    <ion-slide ng-repeat="test in tests">

        {{test.name}}

    </ion-slide>
 </ion-slides>

The page doesn't appear even thou the console.log is fired. I'm guessing there is some syntax error in my html which I failed to notice.Do i have to use collection-repeat instead in Ionic 2?

I'm trying to do a slider style page which presents dynamic data based on my json file given.

In my controller:

constructor(navController) {
   this.navController = navController;
   this.populateHistory();
}

populateHistory(){
  console.log("populating!");
   var tests = '{[{"name":"jack"},{"name":"john"},{"name":"joe"}]}';
}

In my html:

 <ion-slides>
    <ion-slide ng-repeat="test in tests">

        {{test.name}}

    </ion-slide>
 </ion-slides>

The page doesn't appear even thou the console.log is fired. I'm guessing there is some syntax error in my html which I failed to notice.Do i have to use collection-repeat instead in Ionic 2?

Share Improve this question asked May 17, 2016 at 2:31 GeneGene 2,2184 gold badges31 silver badges52 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

there is no ng-repeat in angular2... should be

<ion-slides *ngIf="tests.length">
  <ion-slide *ngFor="#test of tests">
    <div>
      {{ test.name }}
    </div>
  </ion-slide>
</ion-slides>

but I think you might want to look at this issue to see if it affects you.

https://github./driftyco/ionic/issues/6515

本文标签: javascriptionic 2creating a ngrepeat inside ionslidesStack Overflow