Angular 2 *ngFor only supports to add 10 elements at a time in inline template
See original GitHub issue**I’m submitting a bug.
[x ] bug report
[ ] feature request
[ ] support request
Current behavior
I wanted to repeat particular element several amount of time, so I’m using *ngFor
directive with hard-coded array like [1,2,3,4,5,6,7,8,9,10]
and that got worked awesome. I achieved what I wanted to do.
Code
@Component({
selector: 'my-app',
template: `<h1>My First Angular App</h1>
<div *ngFor="let item of [1,2,3,4,5,6,7,8,9,10]">
{{item}}: My Element
</div>`
})
[Demo Plunkr][1]
But as soon as I increased the array size more than 10, I start getting below error. Which is really annoying.
zone.js@0.6.25?main=browser:355 Unhandled Promise rejection: Unsupported number of argument for pure functions: 11 ; Zone: <root> ; Task: Promise.then ; Value: Error: Unsupported number of argument for pure functions: 11(…) Error: Unsupported number of argument for pure functions: 11
Template
<div *ngFor="let item of [1,2,3,4,5,6,7,8,9,10,11]">
{{item}}
</div>`
Expected behavior
I’m curious to know why that error is happening as soon as array size increase more than 10? But another interesting thing is when I put the same array in component inside variable items= [1,2,3,4,5,6,7,8,9,10,11]
and used items
in *ngFor
and it got worked.
-
Angular version: 2.0.1
-
Browser: all
-
Language: TypeScript
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (6 by maintainers)
This is working now in Angular 4.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.