0

I have following code in my django template :

<li class="item" ng-repeat="(key, value) in products" style=" ">
    <a href="{% url 'appname:productdetail' 150 %}" class="icon">View</a>
</li>

here 150 is value.id which i would access as {$value.id$} as I am using interpolate provider.

but I can't write something like:

<a href="{% url 'appname:productdetail' {$value.id$} %}" class="icon">View</a>

as it is npot valid for template.

I am stuck that how I can create URL in template using angular expression. Any suggestions or help would be appreciated.

1
  • you need to put your url in your controller, and append it with value.id in your view Commented Jun 17, 2016 at 10:06

1 Answer 1

0

This is the way I have found so far:

<a href="{% url 'appname:productdetail' ''%}{$value.id$}/" class="icon">View</a>

In some cases it can work without empty quotes.

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.