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

When can.Component updates the view? Is there any callback or event? (like inserted, removed)

$
0
0
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:
  1. can.Component.extend({
    tag: 'panel',

    viewModel: {
    active: false,
    },

    events: {
    '{viewModel} active': function() {
    this.element.trigger('panelActivated');
    },
    inserted: function() {...},
    removed: function() {...}
    }
    });
Template: (Musatche)
  1. {{#if active}}
    <div class="panel-content">{{> panelContent}}</div>
    {{/if}}

Viewing all articles
Browse latest Browse all 3491

Trending Articles