1

I have kendo grid where i am using anchor tag so using href i am trying to pass two params from client side but it always give syntax error, any help what is correct way to pass variables using href.

config.js

toolbar: [{template: '<a class="btn btn-default btn-sm pull-right"  
      href="app/challenge/rest/exportChallengeGridDataToExcel?key={{$rootScope.id}}  
        &challengeType={{$rootScope.challengeType}}">Export to Excel</a>'}]
4
  • what error u get....? Commented Apr 25, 2016 at 14:17
  • I would recommend you to extract that to a function Commented Apr 25, 2016 at 14:17
  • i did extract that to function before but there i have other problems i get blob content in response but its not prompting to for download in browser so i came with this approach Commented Apr 25, 2016 at 14:22
  • Can you console.log challengeType and prcs_id and see a value or are they undefined? Commented Apr 25, 2016 at 14:26

1 Answer 1

1

You can do something like :

'<a class="btn btn-default btn-sm pull-right"  
href="app/challenge/rest/exportChallengeGridDataToExcel?key={{$rootScope.id}}  
&challengeType={{$rootScope.challengeType}}">Export to Excel</a>

Anyways I would encourage you to use $rootScope as less as possible, also to build your URL in your controller so your html looks more readable, but that's up to you

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

3 Comments

I used your approach but its still not working getting syntax error illegal token , edited my question.
Could you make a code snippet in jsbin or plunker? So I can help you? Also try changing the href by ng-href, just in case
it worked for me without curly braces, Thanks for the help

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.