Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4870

Runloop with did-update modifier

$
0
0

Hi, I am trying to figure out how did-update works. Let’s assume I have a component with:

<ul {{did-update this.didUpdate @someParam}}>
  {{#each this.myArray as |item|}}
     <li>{{item}}</li>
  {{/each}}
</ul>

and

@action
didUpdate() {
    this.myArray = [1, 2, 3, 4, 5, 6, 7];
    scheduleOnce('afterRender', () => {
        // .. get the height of ul or do some dom manipulation
       // The items are not rendered yet
    }
}

So my question is, why aren’t the items rendered yet? Is this the expected behavior? If yes, then how can I do some DOM manipulation, after a did-update function call, in which I want to modify some tracked attributes, that will alter the DOM element I am trying to manipulate. Thanks.

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4870

Trending Articles