Take the 2-minute tour ×
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It's 100% free, no registration required.

Does anyone have an experience in using Craft in conjunction with a front-end JS MVC/MVVM framework such as Backbone, Ember or Angular?

We have a project coming up where there may be a lot of JS state management requirement and AJAX calls required, and would like to access back-end data using JSON. However, there is also a strong need for a robust easy-to-use CMS as there will be a lot of content to administer.

My first port of call for this type of application would be some more general server-side framework such as Laravel, but Craft has sort of spoiled us with the content management side of things.

Is there any way of marrying Craft with this kind of project?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I am just starting out on a project using both Craft and Angular. I ran into an early issue because both Angular and Twig use the {{ }} braces, but that was quickly fixed by changing Angular’s settings like in this Stackover flow post.

As Christian noted in the comments, though, you could also use the {% verbatim %} tag to keep Craft from parsing Angular tags.

Aside from that, I haven't had issues since Craft gives you full frontend control and there are no CMS scripts on the frontend to worry about. And (so far) Craft's dynamic routes make it really quite easy to set up your templates, JSON, etc.

share|improve this answer
1  
Twig also has the {% verbatim %} tag for sections that shouldn't be parsed. I'd simply wrap my Angular code with that. –  Christian Seelbach Jul 4 at 14:50
    
This is a great point - I've heard that some outside Angular modules may have braces hardcoded, so this may be a more surefire way for them to work properly. –  Patrick Harrington Jul 4 at 14:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.