Subhajit Subhajit - 1 year ago 152
TypeScript Question

How to use Django templating inside Angular 2 template?

I am trying to iterate through a django object rendered to an HTML page by the view.
I defined an Angular 2 component in the following manner :-


selector: 'search',

<form [ngFormModel]="form" >
{% for category in categories_all %}
<div class="checkbox">
<input type="radio" name="category"
ngControl = "category"
{% ifequal|stringformat:"s"
param_values.category_id|stringformat:"s" %}
{% endifequal %}
</li>{% endfor %}
providers:[ HTTP_PROVIDERS]


{% for category in categories_all %}
is django templating syntax so angular2 is not identifying it. Is there any way to resolve this issue?

Answer Source

you should define your own template tags like this

AngularJS module (app.js)

angular.module('myapp', []).config(function($interpolateProvider) {


<a>[[ variable ]]</a> 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download