app.directive('listScroll', function() { return { restrict: 'E', scope: { data: '=', // name: '=' }, template: '
' + '
' + '
' + '
{{x[name]||x}}
' + '
' + '
' + '
' + '
', link: function($scope, element, attrs) { $scope.name = attrs.name; $scope.renderFinish = function() { var mySwiper1 = new Swiper('.swiper-container', { direction: 'vertical', slidesPerView: 5, centeredSlides: true }) } } } }) app.directive('repeatFinish', function() { return { link: function(scope, element, attr) { if (scope.$last == true) { // console.log(x) scope.$eval(attr.repeatFinish) } } } })