2

i have a Ionic v1 project using turn.js but now i'm using Ionic v2. I'm having problem with import the turn.js using with the jQuery.

angular.module('albumController', [])

.directive('flipbook', function () {
return {
    restrict: 'E',
    replace: true,
    compile: function (element, attrs) {
        element.turn({
            width: '300px',
            height: '300px',
            pages: 8
        }).turn('peel', 'br');

        element.addClass('flipbook');
        return function (scope, el) {
            el.on('click', '[data-page]', function (e) {
                el.turn('page', $(e.target).data('page'));
            }); 
        };
    },
    templateUrl: "flipbook.html"
}
});

Thanks!

  • What problem are you having. A better explanation would help people find an answer for you. – Fencer04 Sep 12 '16 at 18:52
  • @Fencer04 I can't use the method "turn" in $('#flipbook').turn('next'); The vs code says that Property 'turn' does not exist on typeof jQuery – Lucas Gaspar Sep 12 '16 at 19:20

1 Answers1

0

I don't know if you already have the answer. For me I do the following:

  1. install jquery for ionic(check it here)
  2. npm install --save turn.js

  3. import $ from "jquery"; import "turn.js";

just that you can use $().turn();

hope it help :D

d4v1d
  • 341
  • 2
  • 6