Prevent code repetition in html file


#1

My app is getting a bit bulky because of a lot of code repetition can anyone suggest me how to prevent this.

<ion-item>
 here is text 1
</ion-item>

<ion-item>
here is text 2
</ion-tem>
......

like this many ion-items are there how to prevent this repetition?


#2

NgFor. Just google it. And I recommend you read Angular 2 docs


#3

You can put the contents of your ion-items into a collection, such as an array. Then you use “*ngFor” to iterate over them. https://angular.io/docs/ts/latest/api/common/NgFor-directive.html

Take a look at the Angular2 docs. There’s some gaps in documentation currently but go through the tutorial and it will give you some great fundamentals to get you started (including “*ngFor”)
https://angular.io/docs/ts/latest/quickstart.html