$includeContentLoaded
is fired every time ngInclude
is updated.
$scope.$on('$includeContentLoaded', function() {
// Emitted every time the ngInclude content is reloaded
});
What I would like to do, is to listen for a specific ngInclude
to be loaded, like a callback:
$scope.includePath('/path/to/iclude', function() {
// Fired when the includePath ngInclude have finished loading
}
Is this possible?
You can use "onload" tag:
<div ng-include="url" onload="test(url)">
</div>
And check url in scope function, for example:
$scope.test = function(url){
switch(url) {
case '/path/to/iclude':
/*******YOUR CODE***********/
break;
}
}
in Angular 1.3, you have:
$rootScope.$on('$includeContentLoaded',function(event,url){
if (url == 'YourDesiredPath') {
// do something
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With