0

All of my syntactic attempts have failed and the documentation on this particular case is hard to find, perhaps you know better.

.factsheet(ng-repeat="factsheet in factsheets)
    a(ng-href="{{factsheet.link}}", onclick="aFunction('click', {{factsheet.title}})")

ng-href="{{factsheet.link}}", works like a charm. {{factsheet.title}} is the variable which can't be accessed.

I've tried this

factsheet.title

and that

#{factsheet.title}

and this

"{{factsheet.title}}"

and other desperate attempts...

'{{factsheet.title}}', "#{{factsheet.title}}"

Nothing works, although I can access the title attribute easily outside of the inline JS

h2 {{factsheet.title[currentLang]}} // no worries
Félix Paradis
  • 5,165
  • 6
  • 40
  • 49

1 Answers1

0

K, so after reading similar questions, especially this one, I figured this was just not the way to go and ended up using ng-click like so:

.factsheet(ng-repeat="factsheet in factsheets)
    a(ng-href="{{factsheet.link}}", ng-click="aFunction('click', factsheet.title)")

Less inline JS is always a good thing anyway!

Félix Paradis
  • 5,165
  • 6
  • 40
  • 49