您需要等待ng-repeat呈现,然后才能更新()幻灯片框,请使用以下指令:
angular.module('starter') .directive('repeatDone', function () { return function (scope, element, attrs) { if (scope.$last) { // all are rendered scope.$eval(attrs.repeatDone); } }})
HTML:
<ion-slide-box> <ion-slide ng-repeat="day in week" repeat-done="repeatDone()" >
在您的控制器中
$scope.getFiles = function() { Files.query({ //some parameters }).$promise.then(function(data) { $scope.week = data;});$scope.repeatDone = function() { $ionicSlideBoxDelegate.update(); //$ionicSlideBoxDelegate.slide($scope.week.length - 1, 1);};
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)