I cam across the same problem. The solution is, you cant use the render function returned by "can.view()" with live-binding. You have to use "can.view()" directly to append the model to the template. Don´t know if thats a bug or design decision.
i had wrote some code like this:
- // new requirejs module
- // depends on a external ejs file
- define(['sometemplate.ejs'], function(template) {
- // register the template, (why i have to do this?)
- can.view.ejs('template_id', template);
- // load controller and deliver a template
- // i dont want a template defined inside my controller
- // because i want to reuse the controller with different
- // templates
- var myController = new SomeController('#domid', {
- template: can.view('template_id')
- });
- });
Inside my controller i use the template as follow
- this.render = function(){
- // render template
- var todom = this.options.template(this.myModel);
- // append
- $("body").html(todom);
- }
This works, but only without live binding. If you use a function from the model inside the template you get an "@@!!@@";
You have to submit the model to the "can.view('template_id', myModel)" method. You cant use the render function returned by "can.view()".