I'm new to ionic 3 and I try to get button list using ng-repeate.These buttons differ from name only.This is my html code

<ion-content padding><div ng-repeat="tip in healthTipsButtonList"><button ion-button (click)="presentActionSheet()" class="button button-dark clearButton" [color]="'secondary'">{{tip}}</button></div></ion-content>

and this is typescript code

@Component({selector: 'page-read',templateUrl: 'read.html',})export class ReadPage {healthTipsButtonList;constructor(public navCtrl: NavController,public actionSheetCtrl: ActionSheetController) {this.healthTipsButtonList=["BEAUTY","FAMILY HEALTH","FITNESS TIPS","HEALTHY TIPS","PREGNANCY"];}presentActionSheet() {//some thing}

But I got this type of output without any errors.

enter image description here

This is my ionic environment details

@ionic/cli-utils : 1.19.1ionic (Ionic CLI) : 3.19.1global packages:cordova (Cordova CLI) : 8.0.0local packages:@ionic/app-scripts : 3.1.8Cordova Platforms : noneIonic Framework : ionic-angular 3.9.2System:Node : v8.9.4npm : 5.6.0OS : Windows 8.1Environment Variables:ANDROID_HOME : not set
share|improve this question
  • ng-repeat belongs to angularjs, you should use *ngFor– Bunyamin CoskunerFeb 13 at 17:15
  • Is this Angular or AngularJS? ng-repeat is AngularJS.– DeborahKFeb 13 at 17:16
  • 1
    @DeborahK This is angular.Here is details "@ionic/app-scripts": "3.1.8", "typescript": "2.4.2"– Jayani SumudiniFeb 13 at 17:18

ng-repeat belongs to AngularJs, you have to use *ngFor

Change following code

<div ng-repeat="tip in healthTipsButtonList"><button ion-button (click)="presentActionSheet()" class="button button-dark clearButton" [color]="'secondary'">{{tip}}</button></div>

to

<div *ngFor="let tip of healthTipsButtonList"><button ion-button (click)="presentActionSheet()" class="button button-dark clearButton" [color]="'secondary'">{{tip}}</button></div>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.