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

Is there a way to set a template for a can.Component through a parameter?

$
0
0
Hello All,

I would like to pass in a parameter to a can.Component as the template to render or use a default view similar to what I can do with can.Control:

  1. can.Control.extend({
  2.       defaults: {
  3.             view: 'foo.mustache' // use this as default view unless I pass in another view through the options.
  4.       }
  5. }, {
  6.       init: function() {
  7.             can.view(this.options.view)
  8.       }
  9. });
Can I do something similar with can.Component?
  1. can.Component.extend({
  2.       ...
  3.       template: this.options.view, // something like this?
  4.       ...
  5. });

Thanks,
Colin

Viewing all articles
Browse latest Browse all 3491

Trending Articles