I am using a package for my layout and I need to javascript call to fire after the elements have all loaded on the page, but I cannot get it to work.
ionViewDidEnter() {
this.graphs = [];
// console.log("View Entering", this.iter);
this.setCurrentPosition();
this.clientService.clientStream$.subscribe(
client => {
this.client = client;
this.isLoading = false;
this.setupGrid();
}
)
}
setupGrid() {
var elem = document.querySelector('.pckry-grid');
// Prints "setting up grid, null"
console.log("setting up grid", elem)
var pckry = new Packery( elem, {
itemSelector: ".grid-item"
});
}
Here's the view:
<div class="pckry-grid" *ngIf="!isLoading">
<div class="grid-item g-col-12">
...
</div>
<div class="grid-item g-col-12">
...
</div>
<div class="grid-item g-col-12">
...
</div>
<div class="grid-item g-col-12">
...
</div>
</div>
Is there a different hook I can use to prevent the setupGrid()
function from calling before the elements load?