0

This is a generic question don't need the "ready to use" code , but an idea where should invest my time in. I set mustache tag because may be similar.

This is an express (4) application using .doT template where i want to expand with some angular (1.4.3) features.

  1. Doesn't seem possible to me to work with .doT template and angularjs , I'm i right here? .I'm trying get it to work a .html template file and his angular application without success( return a 404 cause don't find a template, but when i use with ejs, it does work ( because it read .html files)

2 . STILL , would like to know in case i'm wrong above. considering this anwer that state is possible to use multiple view engine with consolidate. is possible and how would it be done with angular? (just a hint, doens't need to be the whole implementation)

  1. I know by this answer would be possible to use this below, but also says is better to use a helper, is possible to use helpers in.doT template ? , how?

    appModule.config(function($interpolateProvider) {
      $interpolateProvider.startSymbol('{[{');
      $interpolateProvider.endSymbol('}]}');
    });
    
  2. considering the above. Which one of 2 and 3 whould you say would be faster?

  3. it would considerably be faster if I change my app to ejs view engine ?

MikZuit
  • 684
  • 5
  • 17

1 Answers1

0

Point by point :

  1. This is incorrect , .doT template works well with Angular, I have use it both, as long as you render a route with dot.

     router.get("/blog/new", function(req, res) {
         res.render("owner/blog/create");
     });
    

and set a state in your angular provider like

  $stateProvider
   ...
    .state("owner-new-blog", {
        url: "/blog/new",
        templateUrl: "/owner/blog/new",
        controller: "CreateUpdateCtrl"
    })
  1. There is no point to use consolidate middleware, .doT template works with angular template out of the box, unless you change .doT default parameters.
  2. Yes ... that would be like this , like state in this post

    var dT = require('doT');
    var tpl = {
         tmpl:dT.template('{{=this.helper()}}'),
         helper: function(){
             /* do what you want to do */
         }
    }
    tpl.tmpl(); // render template
    
  3. as you can see in this benchmark , .doT is pretty fast if you set double engine in you app , is a bit slowe since you are expanded is functionallity, if you set a helper in doT is less painfull than having two engines .. so , is faster adding a Helper to dot.

  4. there is no point in changing to ejs , dot is pretty fast and an advance template engines which suport layouts and partials. and still , in my opinion, is faster.

MikZuit
  • 684
  • 5
  • 17