Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : can.view("only url") vs can.view.render("only url") - when no data object is passed to methods - is there any difference?

$
0
0
var a = can.Control.extend({
      init: function(element, options) {  
        a.findAll({}, function(response) {
          element.html(can.view('a.ejs',
            {
              d: response
            }
          ))
        })
      }
    });     

var b = can.Control.extend({
      init: function(element, options) {
        var that = this;
        can.view('b.ejs', b.findAll({}).then(function(d) { 
          return { b : d  };
          })).done(function(frag) 
            { 
              that.element.html(frag); 
            })
      }
    });

Out of this two which one is better and why ??

 I feel the previous one is less better for deferring the values and also to embed it more parameters. Also in second one we can use combination of b.findAll and also b.findOne

Viewing all articles
Browse latest Browse all 3491

Trending Articles