1

I'm trying to pass 3 arguments im gettting using ng-repeat to javascript function but i cant figure out how. i tried to do it this way:

  <tbody ng-repeat="(user_id, row) in data">
                <tr ng-repeat="(script_id, cron_format) in row ">
                    <td ng-model="user_name">{{user(user_id)}}</td>
                    <td ng-model="script_name">{{script(script_id)}}</td>
                    <td ng-model="cron_format"><span ng-repeat="l in letters(cron_format) track by $index">{{l}}</span><button class="save"  onclick="saveCron(user_id,script_id,cron_format)">save</button></td>
                </tr>
            </tbody>

but it wont work can someone explain why please?

1
  • onclick should be ng-click if you are calling angular clock event Commented Feb 11, 2015 at 11:53

2 Answers 2

1

You should use ng-click for angular click events so:-

   <td ng-model="cron_format"><span ng-repeat="l in letters(cron_format) track by $index">{{l}}</span><button class="save"  ng-click="saveCron(user_id,script_id,cron_format)">save</button></td>
                </tr>

will help you out.

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

Comments

0

The above code is not working because you are using the wrong syntax.

The function for javascript should not be called within the curly braces else it should be called directly. Like you have called another JS function in line 5 of your code as follows:

onclick = "anyFunction()"

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.