Reputation: 137
I'm developing an app with AngularJS. I have this function declared in the controller:
$scope.showModal = function(modalId){
alert(modalId);
$(modalId).openModal();
};
Then I have a hyperlink which calls this function:
<a ng-click="showModal('#modal{{jsonObject._id}}');" >link</a>
The JSON Object ID is "1". In the navigator, I can see that the HTML code of the link is this:
<a ng-click="showModal('#modal1');" >link</a>
But when I click the link, the alert shows this:
#modal{{jsonObject._id}}
Instead of "#modal1".
Am I doing something wrong?
Thanks in advance.
Upvotes: 0
Views: 117
Reputation: 2053
In the ng-click
you are in the angular context, so you have not to use {{}}
.
<a ng-click="showModal('#modal'+jsonObject._id);" >link</a>
Upvotes: 2