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

Re : Helpers in Partials

$
0
0

I sort of found a solution in case anyone else runs into this.

I updated my jsfiddle http://jsfiddle.net/5zpFz/127/

Basically I need to call a template that includes a partial, inside of the partial I am trying to call a simple helper to do some formatting.  When I try to render the view like 

  1. $('body').append( can.view('outer', {}, {
  2.     helloer:function(name) {
  3.         return 'hello ' + name;
  4.     }
  5. }) );

The partial template never calls this helper.  However when I change it slightly to call the like this

  1. tmp = can.view('inner');
  2. $('body').append( can.view('outer', {}, {
  3.     helpers: {
  4.          helloer:function(name) {
  5.             return 'hello ' + name;
  6.         }
  7.       },
  8.       partials: {
  9.          tmp: tmp
  10.       }
  11. }) );

In this case it works.


Viewing all articles
Browse latest Browse all 3491

Trending Articles