Prevent code repetition in html file

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

 here is text 1

here is text 2

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

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

You can put the contents of your ion-items into a collection, such as an array. Then you use “*ngFor” to iterate over them.

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”)

1 Like