1

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}});].

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

4 Comments

If we remove the curly braces then we don't get the evaluated value. Please let me know your thoughts.
I just realized the place where you have error is not the same as the code you posted. Where is document.DocumentEnglishTitle? It's not the same as document.DocumentTitle
even we have corrected that still we getting same error.
you will need to check if your document.DownloadLink really exist in your controller as $scope.document.DownloadLink or not. If there is such $scope variable, there is no way the error would be thrown like that.

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.