1

I want to loop on an array .

There is my code:

@Input()
applicationLinks: ApplicationLink[];


applicationRows: ApplicationLinkRow[];
for(applicationLink in applicationLinks) {
    applicationRows.push(applicationLink);
}

in gives a compilation error

(= expected).

i had try also

for(applicationLink of applicationLinks)
for(var applicationLink in applicationLinks)
for(var applicationLink of applicationLinks)

Each time gives a compilation error !

1 Answer 1

3

You need to move this code into a method or the constructor

for(applicationLink in applicationLinks) {
    applicationRows.push(applicationLink);
}

should be something like:

class SomeClass {
  @Input()
  applicationLinks: ApplicationLink[];


  applicationRows: ApplicationLinkRow[];

  someMethod() {
    for(applicationLink in applicationLinks) {
        applicationRows.push(applicationLink);
    }
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.