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

CanJS - Mustache strange behavior

$
0
0
Hi guys,
I'm having problem using mustache in my application.
I've stolen 'can.....mustache' and  I've a Model object with this structure:

  1. // widgets
  2.            Models.LayoutWidget = can.Model({
  3.                 findAll: 'GET /pages/{id}/layouts/widgets'
  4.             }, {});

    Then with a fixture helper it grab these:

    1. var LAYOUT_WIDGETS = [
    2.         {
    3.             id: 1,
    4.             name: 'Menu',
    5.             config: {
    6.                 width: 4,
    7.                 height: 1
    8.             }
    9.         }
    10.     ];

    and that's the template:

    1. <script id="layout-widget-template" type="text/mustache">
    2.     <li class="layout-widget" {{data 'widget'}}>
    3.         <span class="layout-widget-delete">&times;</span>
    4.         <span class="layout-widget-name">{{name}}</span>
    5.     </li>
    6. </script>

    Now the problem if i use these object with this following code

    1. var template = can.trim(can.view.render('#layout-widget-template', widget));
    2. // or
    3. var template = can.trim(can.view('#layout-widget-template', widget));
    4. // or same without trim

    it just gives me 

    1. <li class="layout-widget" data-view-id='2'>
    2. <span class="layout-widget-delete">&times;</span>
    3. <span class="layout-widget-name"><span data-view-id='3'>@@!!@@</span></span>
    4. </li>

    wtf.....are those "@@!!@@" ??? i've tried self.name, this.name also in my template!!!
    Any help??? Tnx in advance!!!

    Viewing all articles
    Browse latest Browse all 3491

    Trending Articles