Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to use an angular variable as a JavaScript parameters like this:

 <li ng-repeat="link in Links">
    <button data-icon="gear" data-role="button" data-iconpos="right" type="button" id="bitrate_btn_{{ link.Code }}" class="bitrate_btn btn" onClick="play_live_ind({{link.Code}});">
        {{ link.Title }} ( {{ link.Bitrate }} Kbps )
    </button>
 </li>

As you can see I'm calling a method called play_live_ind like this:

play_live_ind({{link.Code}});

It's not working, as the page loads it exactly prints play_live_ind({{link.Code}});

How can I pass the value of link to this JavaScript function?

This is a jw-player function that I can't rewrite it in angular because it has many function call on itself. So I need to call this function in javascript

So I just need a solution to pass the angular variable value to the Javascript function

share|improve this question
3  
Use ng-click instead of onClick. –  Pramod Karandikar 17 hours ago
    
This function is a javascript function, I used it with ng-click but because it's not a angular fucntion, it won't run, how can I run it then? –  MasOud 16 hours ago
    
define play_live_ind as $scope.play_live_ind = function(inputs) { // function body} –  Pramod Karandikar 16 hours ago
    
This is not my function, this is jw-player functions so I can't rewrite them in angular, it has many dependencies, so I need a solution to pass the angular value to the javascript function –  MasOud 8 hours ago

1 Answer 1

Use ng-click instead of onClick, and define play_live_ind in your $scope.

$scope.play_live_ind = function(inputs) { 
                          // function body 
                       }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.