Hello everyone,
Who knows how can I check if view in can.Component was updated. I
mean if I change something in the viewModel, I need to know when these
changes applied on the DOM.
The example, I have a viewModel in Component with
"active" property, the idea is to trigger the event
"panelActivated"
when active is true. It triggers, but when i catch it on the paren
Controls, the {{#if active}}DOM{{/if}} is not ready :(
Component:
-
can.Component.extend({
tag: 'panel',
viewModel: {
active: false,
},
events: {
'{viewModel} active': function() {
this.element.trigger('panelActivated');
},
inserted: function() {...},
removed: function() {...}
}
});
Template: (Musatche)
-
{{#if active}}
<div class="panel-content">{{> panelContent}}</div>
{{/if}}