Skip to content

Angular 2 *ngFor only supports to add 10 elements at a time in inline template #12233

@pankajparkar

Description

@pankajparkar

**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: ;
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions