Dan Cancro Dan Cancro - 2 years ago 130
AngularJS Question

In <template ngFor #item [ngForOf]="items">, item displays as [object Object]

If I interpolate a string variable in a repeated

it shows up correctly, but if I put it in a
it shows up as [object Object]. Why is that? I've seen a few evolutions of the
syntax but none seems to work.


Answer Source

If you use #item then item will refer to TemplateRef. You need to use let-item like this:

<template ngFor let-item [ngForOf]="items">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download