Best_Where_Gives
Best_Where_Gives

Reputation: 481

Jade for-loop with #{self.variable} NOT fixed List

It must be an extremely special case i´m asking for, since there are over 1000 Pages of the standard for/each concept of jade:

each value, index in [1,2,3]
  li= val + ':' + index

But I want to use my own dynamical list (from outside), e.g.

#{self.trolls}

This does not work:

each value, index in #{self.trolls}
  li= val + ':' + index

Error thrown: Unexpected token ILLEGAL

Any suggestions?

I also tried:

- trolls= #{self.trolls}

Throws error too

Upvotes: 0

Views: 58

Answers (1)

Ben Fortune
Ben Fortune

Reputation: 32127

self.trolls is available to the jade script, #{} is only for outputting it.

You can simply just use

each value, index in self.trolls

Upvotes: 1

Related Questions