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

Rendering Map and Model using mustache #each helper

$
0
0
Hello everyone,

I tried to render a can.Model.extend using {{#each myModel}} helper with {{@key}} and {{.}} to display my model. It displays perfectly when I try to add or remove an attribute to my model: the view correctly is updated. No problem here.
But I am encountering a problem
 when I try to update an attribute, like :
  1. myModel.attr('myAttribute', 'newValue');
I noticed, using console logs, the attribute is correctly updated but the view does not update at all. I think I am doing something wrong, but I can not figure out what.

I wrote a sample using can.Map (it is quicker to write, and I noticed the same problem): http://jsfiddle.net/v4o0zs06/6/
You can notice there is no problem with adding and removing the attribute, but there is no update on the view when the attribute changes (change can be verified using console).

Maybe using {{#myModel}} helper would change something, but I would not access to {{@key}} helper anymore, isn't it ?

Thanks.



Viewing all articles
Browse latest Browse all 3491

Trending Articles