문제

First, django template language is used on server-side to publish the static html pages.

Within the HTML pages, I am trying to find some client-side javascript framework which can provide some sort of structure (MVC, MVP, MVVM, MVW. ect.)

AngularJS, Ember.js, Soma.js, they conflict with the Django template language

Knockout seems is the only choice so far. any more suggestions? Thank you

도움이 되었습니까?

해결책

angularJS works fine with django template language with one simple change.

The $interpolateProvider service controls the interpolation symbols, which can be changed, angularjs use of {{}} is just a default.

http://docs.angularjs.org/api/ng.$interpolateProvider 

To change the symbols, to say '{[{}]}', its simply:

 app.config(function($interpolateProvider) {
 $interpolateProvider.startSymbol('{[{');
 $interpolateProvider.endSymbol('}]}');
 });

다른 팁

Have you and a look at anything that Toran https://github.com/toranb is doing with django and ember? He is great and a wonderful teacher. Here is a link to a django ember example https://github.com/toranb/ember-django-rest. Here is a video about ember with a django backend. http://toranbillups.com/blog/archive/2013/01/03/Intro-to-ember-js-and-the-new-router-api/

I hope this is helpful.

Cheers Dave

You can change the template delimiters in Soma-template easily using the settings:

settings.tokens.start("[[");
settings.tokens.end("]]");

Then you could write your template code like this:

<h1>[[title]]</h1>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top