I don't want to add any noise here- but I just had a chance to glance over
this conversation and I've basically been doing what Carl describes with
Angular. (In fact I joke often about calling it Djangular). I have a view
that prerenders angular templates (accepts the path to the template in the
url e.g. /views/renderng/path/to/ng/template.html) filling in data that is
available on the server and minimizing what I'm tracking in the scope in
Angular.
It's been working really well but I did have to change my Angular
interpolation provider start and end markers to [[ and ]]. So I have
templates similar to:
<div>Hello {{ user.first_name }}</div>
<div>You have [[ data.points ]] points</div>
Or to share a URL for a specific controller:
<div ng-controller="AuthController"
ng-init="init('{% url "auth-login" %}')">
I also do as Carl suggested and smuggle data in script tags. This has been
useful when rendering the base template and sharing global URLs.
<script>
window.foo = {
urls: {
dataEndpointFoo: "{% url "endpoint-foo" %}"
}
};
</script>
On Tue, Jun 2, 2015 at 3:05 PM, Emil Stenström <[email protected]> wrote:
> On Tuesday, 2 June 2015 20:31:41 UTC+2, Carl Meyer wrote:
>>
>> On 06/02/2015 11:53 AM, Emil Stenström wrote:
>> > I would love to see some code here if you have it available? How do you
>> > pass the JSON and the templates from the view to the client side?
>>
>> I don't have code I can share at the moment, but I'm hoping to blog
>> about this technique, and I'll let you know if/when I do.
>>
>
> Please do, and thanks again for sharing how you get this going. I
> subscribed to the oddbird blog, so if you post it there you don't have to
> tell me :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/a34fff52-24df-4a54-a512-0553b0ffc322%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/a34fff52-24df-4a54-a512-0553b0ffc322%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/CAABi-DpknKGODsVqW%2BSik-96JpBJcp3%3DZ0Wjk3NVpBPhA2e_5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.