jrief / djangocms-angular-compendium

Template overrides for DjangoCMS plugins when used with AngularJS
MIT License
0 stars 0 forks source link

Tips needed for intagrating django-cms and angularjs #1

Open pawelkowalak opened 10 years ago

pawelkowalak commented 10 years ago

What's the preferred way of integrating django-cms and angularjs? I'd like to achieve page transitions between CMS pages. Is it possible at all at the moment?

Also, how to separate Django templates and AngularJS templates to avoid markup collisions?

Thanks in advance!

jrief commented 10 years ago

ad 1) I would simply overload the templates by placing them BEFORE the template search path. For instance templates/cmsplugin_filer_image/image.html is made to work together with this AngularJS directive: https://github.com/jrief/angular-retina.

ad 2) a) You can do it from Django >=1.5 using the {% verbatim %} Angular stuff {% endverbatim %} template tag.

b) You can do it from AngularJS on module initialization:

angular.module('MyModule').config(function($interpolateProvider) {
    $interpolateProvider.startSymbol('{$');
    $interpolateProvider.endSymbol('$}');
});

now {$ varname $} is for an Angular scope (context in Django terminology), while {{ varname }} is for a Django context.