Callback when all Template items finished rendering in Meteor?

前端 未结 7 970
-上瘾入骨i
-上瘾入骨i 2020-12-19 09:30

I\'m getting a collection of records and placing them in a Template, having them rendered {{#each}} and I want to display a loading icon until the last DOM node

7条回答
  •  有刺的猬
    2020-12-19 10:06

    I find it helpful to run a callback in the onRendered block of the next template:

    
    

    then:

    Template.didMyStuffLoad.rendered = function () {
      Session.set('loading_stuff', false);
    }
    

    Everything will be loaded into the DOM before this onRendered block executes.

提交回复
热议问题