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

Live binding on mustache template does not seem to be working with nested properties

$
0
0
I have a simple example in which a nested property fails to live bind and propagate the change to the template. I change an attribute of an array index inside an object and nothing changes on the view.

  1. var obj = {
        todos: [ 'Line #1', 'Line #2', 'Line #3' ],
        message: 'Hello',
        count: 2  
    };

    var cObj = new can.Observe(obj);
    var template = can.view('example.mustache', cObj);
    can.$(document.body).append(template);
Template is as follows (example.mustache)
  1. <ul>
       {{#todos}}
       <li>{{.}}</li>
       {{/todos}}
    </ul>
    <div>{{message}}</div>

If I do

Viewing all articles
Browse latest Browse all 3491

Trending Articles