Ionic v1:离子滑动事件未触发

时间:2017-11-13 07:07:26

标签: ionic-framework ion-slides ion-slide-box

我正在使用Ionic 1.3.3。我想在幻灯片中添加一个动作事件,但事件根本不会触发。控制台中没有出现以下内容:

模板:

<ion-slides options="options" slider="data.slider">
  <ion-slide-page ng-repeat="profile in home.profiles">
    <div class="card image">
      <div id="container-{{profile.$id}}"></div>
    </div>
    <div class="item">
      <h2>{{profile.displayName}}, {{profile.age}} (<i class="ion-heart"></i> {{profile.stars}})</h2>
    </div>
  </ion-slide-page>
</ion-slides>

控制器:

app.controller('HomeCtrl', function (Auth, $ionicLoading, $scope, $ionicSlideBoxDelegate) {

  var home = this;

  $scope.options = {
    loop: false,
    speed: 800,
    pagination: false,
  };

  $scope.$on('$ionicSlides.sliderInitialized', function (event, data) {
    // data.slider is the instance of Swiper
    console.log('initialized');
    $scope.slider = data.slider;
  });

  $scope.$on('$ionicSlides.slideChangeStart', function (event, data) {
    console.log('Slide change is beginning');
  });

  $scope.$on('$ionicSlides.slideChangeEnd', function (event, data) {
    // note: the indexes are 0-based
    console.log('Slide change ended');
    $scope.activeIndex = data.slider.activeIndex;
    $scope.previousIndex = data.slider.previousIndex;
  });

});

我从离子v1文档中复制粘贴了大部分内容。我错过了什么?

0 个答案:

没有答案