宣告
var App = angular.module('App', ['infinite-scroll']);
App.directive('onFinishRender', function ($timeout) {
return {
restrict: 'A',
link: function (scope, element, attr) {
if (scope.$last === true) {
$timeout(function () {
scope.$emit(attr.broadcasteventname ? attr.broadcasteventname : 'ngRepeatFinished');
});
}
}
}
});
Html
{{p.Name}}
{{n.Name}}
Controller
App.controller('Ctrl', function ($scope, $http,$sce) {
$scope.$on("productsRepeatFinished", function(ngRepeatFinishedEvent) {
console.log("Products");
});
$scope.$on("newsRepeatFinished", function(ngRepeatFinishedEvent) {
console.log("News");
});
});
留言