arielfaur / ionic-wizard

A set of angular directives to create a wizard using Ionic's slide box
http://arielfaur.github.io/ionic-wizard
MIT License
81 stars 26 forks source link

Cannot read property 'slideNext' of undefined #22

Open zeeshan-m opened 8 years ago

zeeshan-m commented 8 years ago

The error is thrown on:

            scope.$on("wizard:Next", function() {
                scope.swiper.slideNext(true);
            });

I copied over the sample wizard from here: https://plnkr.co/edit/azYKSAYOMv0pZu8YEWVs and I get the "Cannot read property 'slideNext' of undefined" whenever I hit next in the wizard. ionic.wizard is added as a dependency into the app and ion-wizard.js is loaded. Any idea what's going wrong?

frey1esm commented 7 years ago

Did you resolve this? If so, how?

jxnx888 commented 1 year ago
  const [swiper, setSwiper] = React.useState(null);

  const nexto = () => {
    swiper.slideNext();
  };
  return (
    <div>
      <Swiper
        spaceBetween={50}
        slidesPerView={1}
        onSwiper={(s) => {
          console.log("initialize swiper", s);
          setSwiper(s);
        }}
      >
        <SwiperSlide style={{ height: 100 }}>Slide 1</SwiperSlide>
        <SwiperSlide>Slide 2</SwiperSlide>
        <SwiperSlide>Slide 3</SwiperSlide>
        <SwiperSlide>Slide 4</SwiperSlide>
      </Swiper>
      <button onClick={nexto}>next</button>
    </div>
  );
}
jxlagbh360 commented 1 month ago
  const [swiper, setSwiper] = React.useState(null);

  const nexto = () => {
    swiper.slideNext();
  };
  return (
    <div>
      <Swiper
        spaceBetween={50}
        slidesPerView={1}
        onSwiper={(s) => {
          console.log("initialize swiper", s);
          setSwiper(s);
        }}
      >
        <SwiperSlide style={{ height: 100 }}>Slide 1</SwiperSlide>
        <SwiperSlide>Slide 2</SwiperSlide>
        <SwiperSlide>Slide 3</SwiperSlide>
        <SwiperSlide>Slide 4</SwiperSlide>
      </Swiper>
      <button onClick={nexto}>next</button>
    </div>
  );
}

Thank you for helping me solve the problem