1👍
A better option is to convert the array to json, like so:
import json
TaskNameListJson = json.dumps(TaskNameList)
and in your template (using safe filter for HTML escaping):
{{ TaskNameListJson|safe }}
BTW, you should use the verbatim tags, to avoid conflicts with angular templating syntax: https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#verbatim
Source:stackexchange.com