0

i want to call an Angular function in html file and parameter of that function is a variable created via Django framework. but i get "undefined" error in my javascript. how i can put Django variable into Angular function call?

this:

<div ng-click="getCardInfo(card.name)">

card.name is Django variable.

2
  • please provide more of your code Commented Feb 1, 2015 at 14:55
  • Please, create a code snippet or plunkr example. Commented Feb 1, 2015 at 14:56

1 Answer 1

3

Django template variables will be evaluated before Angular, so the overlapping {{ }} syntax shouldn't pose a problem. Assuming that card.name is your Django variable (and a string), you should be able to put something like this in your template:

<div ng-click="getCardInfo('{{ card.name }}')">
Sign up to request clarification or add additional context in comments.

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.