user7357640
user7357640

Reputation: 11

How to pass angular expression as parameter to normal JS functions?

I have an omniture tracking function name as s.tl(parameter 1, parameter 2, parameter 3) which is written in Normal JS code. I want to call that normal JS function on buy now button click and pass Angular expression as third parameter to that function.

So I am using ng-click as below:

<a class="button" href="documentdownloader.aspx?documentid={{document.DownloadLink}}" ng-click="s.tl(true, 'd',{{document.DocumentTitle}})">Buy now </a>

But getting below error

Syntax Error: Token '{' invalid key at column 17 of the expression [s.tl(true, 'd',{{document.DocumentEnglishTitle}});] starting at [{document.DocumentEnglishTitle}});].

Upvotes: 1

Views: 489

Answers (1)

CozyAzure
CozyAzure

Reputation: 8478

Remove the curly braces in your ng-click, because in ng-click you are already evaluating the angular expression :

<a class="button" href="documentdownloader.aspx?documentid={{document.DownloadLink}}" ng-click="s.tl(true, 'd',document.DocumentTitle)">Buy now </a>

Upvotes: 1

Related Questions