Hi all,
I have a problem by using attributes plugin and live binding.
Define models:
I have a problem by using attributes plugin and live binding.
Define models:
- var Page = can.Model('Models.Page', {
- attributes: {
- Texts: 'Models.Text.models'
- },
- findOne : '/demo/canjs/page/{id}'
- }, {});
- var Text = can.Model('Models.Text', {
- findOne : '/demo/canjs/text/{id}'
- }, {});
now I can use a page object in ejs, e.q.:
- <%= page.attr('title') %>
- <% page.attr('Texts').each(function( text ) { %>
- <%= text.attr('content') %>
- <% }) %>
The internal counter "_bindings" of displayed text object will set to 2.
If you remove the view, the page object will removed from internal page-store. but the text object still remains in the internal text-store with _bindings = 1.
I tryed some subtemplates to, but I got the same issue. By using many objects I will get a memory leak.
Is there some workaround, or do I understood something wrong?
Thank you for your helping.