question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: *ngFor not working in <ion-item>/ <ion-label> combination

See original GitHub issue

Type: <span ionic-type>bug</span>

Ionic Version: <span ionic-version>2.x</span>

Platform: <span ionic-platform>all</span>

<span ionic-description>I have a problem with *ngFor inside a <ion-item> tag.

Not working: The div is not rendered.

<ion-item>
  <ion-label stacked>Test</ion-label>
  <div *ngFor="let r of [0,1,2,3]">Test</div>
</ion-item>

Working:

<ion-item>
  <ion-label stacked>Test</ion-label>
</ion-item>
<div *ngFor="let r of [0,1,2,3]">Test</div>

Is this by design? Or has it to do with ng2?</span>

<span is-issue-template></span>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mpalandcommented, Aug 12, 2016

Thanx, @xr0master for giving advice. Found it right inside the docs here (see “Content and Inputs” section). The item-content attribute is strictly necessary:

<ion-item>
  <ion-label>Label (not working)</ion-label>
  <div item-content *ngFor="let x of [0,1,2,3,4]">Test</div>
</ion-item>
0reactions
ionitron-bot[bot]commented, Sep 4, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: *ngFor not working in <ion-item>/ <ion-label ... - GitHub
I have a problem with *ngFor inside a <ion-item> tag. Not working: The div is not rendered. ... Is this by design? Or...
Read more >
ngfor does not work when displaying multiple cards in ionic ...
I think the error was in the forEach when adding them. I applied another logic using only the map. code
Read more >
Is it a problem in <ion-list> or <ion-item> or the combination of ...
I am trying to use the following code to show a list of items with a radio-button () on left in the item...
Read more >
Building an Ionic 4 Pokédex with Search, Infinite Scroll ...
But in this case with the given API we encounter a few problems: ... *ngIf="pokemon.length == 0"> <ion-item *ngFor="let i of [1,2,3,4,5]"> ...
Read more >
Blog - Crojach Software
While working on a project I came across a situation where I needed to know if a button was clicked by a user...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found