Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MEAN stack - reliance on templating (Angular vs Templating Engines)?

This may come from a lack of experience on the various sections of the MEAN stack, but from the various boilerplates I've seen (mean.io, hackathon-starter, etc.) in the app.js code, there is always a call to using jade templating engine. I know that I can switch this to ejs and the like, but I was wondering if there's a means of doing it to where all of my pages are .html files using AngularJS? The components/templating features I'm interested appear to be in Angular already so I'm not sure what I'm losing if I were to attempt to server .html files instead?

like image 268
Robert Avatar asked Feb 22 '14 18:02

Robert


2 Answers

If you have multiple html pages in your application, template engine can reduce code duplication between them.

Also, you usually need server-side template engine to provide some kind of a fallback to users who don't have javascript turned on (+ search engines).

I prefer jade over other template engines (and plain html), precisely because it's not html. So it doesn't have certain html issues like whitespace nodes, and always compiles into well-formed html file.

like image 170
alex Avatar answered Nov 12 '22 20:11

alex


If you follow meanjs.org it uses swig, which parses as HTML. You may consider doing the same?

like image 34
Jim McNeill Avatar answered Nov 12 '22 21:11

Jim McNeill