yido
yido

Reputation: 317

Run a directive after the DOM has finished rendering AngularJS

I have an object that I will get it from an API which would take a considerable time, I want my directive to wait till it gets data.

Upvotes: 3

Views: 575

Answers (1)

Dan Moldovan
Dan Moldovan

Reputation: 3591

You can read up on ngIf. Now say your data is stored in $scope.data. If you have something like this

<div ng-if="data"></div>

This div will only get injected in the DOM when $scope.data exists, which means you can make it wait for data before it gets injected in the DOM.

Upvotes: 3

Related Questions