I am trying to iterate over the properties of an object using *ngFor but using in. When I try to do this
@Controller({
selector: 'sample-controller',
template: `
<ul>
<li *ngFor="let i in obj">
<b>{{i}}</b>: {{obj[i]}}
</li>
</ul>`
})
class SampleController {
obj = {a: 1, b: 2}
}
I get the error message:
Can't bind to 'ngForIn' since it isn't a known property of 'li'.
I have included FormsModule and BrowserModule in the imports section of the @NgModule for this component.
Is it possible to use ngForIn on li and if not is there an idiomatic alternative?