1

I am using angular js one of my project and I call "ng-click" function as below

<a ng-click="logout'{{x.ParentEntityId['#text']}}')" target="_blank">{{x.Title["#text"]}}</a>

In "x.ParentEntityId['#text']" value is "7560183E-1C37-40FE-BACC-8A5B5021FBD7"

When my page load I am getting below error.

enter image description here

When I passed static value in logout function it working perfectly. Like as below

<a ng-click="logout('hi')" target="_blank">{{x.Title["#text"]}}</a>

Logout function as below:

$scope.logout = function (item) {
                    alert('logout' + item);
                };

Please let me know if I am missing something.

2 Answers 2

4

In ng-click you are in the angular context, so you haven't to use {{}}. Your ng-click: logout'{{x.ParentEntityId['#text']}}') is syntactically incorrect, missing a (. It should be like ng-click="logout(x.ParentEntityId['#text'])".

Sign up to request clarification or add additional context in comments.

Comments

3
hey man, I think you error is clear, in the ng-click directive as you wrote
<a ng-click="logout'{{x.ParentEntityId['#text']}}')"...>
so, after logout is missing the ( sign for the function and I think you wont need to create an expression {{}} inside the function parameter because on the angular directives you dont need to send the value inside {{}} because it knows it is a variable and it will receive the values as logout('something').
so for example you need to put as below:
<a ng-click="logout(x.ParentEntityId['#text'])" target="_blank">{{x.Title["#text"]}}</a>

Comments

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.