0

I'm Working in a personal project but I have a small problem when i want to render some data binding from angularjs in jquery, this is the code.

<div class="claimButton claimActive">
    <a href="{{ product.url }}" target="_blank" onclick="startTimer({{ $index }},{{ product.time }})">CLAIM</a>
</div>

The principal problem inside here

This the original code onclick="startTimer(0,5)" but when i turn in databinding from angularjs onclick="startTimer({{ $index }},{{ product.time }})" stop working and no render the numbers.

I hope that somebody help me to resolve this problem.

8
  • 5
    Your question is not very clear, you need to show more code, and describe exactly what issue you are having Commented Jun 9, 2016 at 9:10
  • Possible duplicate of jQuery click bind with angularjs Commented Jun 9, 2016 at 9:11
  • ngclick is no working Commented Jun 9, 2016 at 9:12
  • use ng-click directive Commented Jun 9, 2016 at 9:14
  • when I try to use ng directive then all the onclick is null Commented Jun 9, 2016 at 9:16

1 Answer 1

0

Assuming you have angular app and controller you can do so

<div class="claimButton claimActive">
    <a href="{{ product.url }}" target="_blank" ng-click="startTimer($index,product.time)">CLAIM</a>
</div>

and in the controller

$scope.startTimer = function(x,y){
    //do your code  x=$index, y=product.time
}
Sign up to request clarification or add additional context in comments.

12 Comments

I Already made the changes, but still no working, it render when I use ng directive but is necessary the function onclick for start the timer when is clicked.
i guess i miss understood your question than! and i guess that you not staying in that page when you click the claim ? means that the controller binding again if you use the same controller
You can try the project here astrofeina.co/angularjs so when you click in CLAIM the counter start when the code is onclick="startTimer(0,5)" but when the code is onclick="startTimer({{ $index }},{{ product.time }})" the numbers no render please check and tell me if you see something
so that didnt help? onclick="angular.element(this).scope().startTimer(this)" but cant pass params
this is a ticking clock check it please
|

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.