Michael Mittelman Michael Mittelman - 6 months ago 50
AngularJS Question

Passing initial data from django to angular 2

I'm working on my first angular 2 app in an existing Django/Angular1 setup. We used to pass initial data in a django template to be consumed by angular in a tag like so:

<script type="text/javascript">
var id = '{{ id }}';

Then the angular app could utilize it by:

$scope.id = id;

How can I accomplish this same functionality with Angular2?


I think django has to do nothing here. According to angular 2

this.id = id