Michael Mittelman Michael Mittelman - 1 year ago 110
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?

Answer Source

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

this.id = id
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download