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

1 Answer 1

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!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.