Reputation: 7737
I want to delay certain directives to only compile after the window load event. They are below the fold and are slowing down the overall Angular bootstrapping process.
So to this end, I want to create an attribute directive that I can add to directives that will delay their compile function - is this possible?
Upvotes: 0
Views: 735
Reputation: 4264
Using $timeout you can put delay functionality.
return function(scope, element, attrs) {
$timeout(function(){
});
}
and don't forget to inject $timeout
.directive('directiveName', function($timeout)
Upvotes: 1
Reputation: 75
Try to put your logic after onload
event. In order to do this, you should use $(window).load()
or $(document).ready()
.
Hope it helps!
Upvotes: 0