4.1.1 • Published 5 years ago

ionic-swing v4.1.1

Weekly downloads
19
License
MIT
Repository
-
Last release
5 years ago

ionic-swing

ionic-swing is a fork of the following projects intended to add the swipeable cards capatibilies to Ionic (>= 2)

Installation

To install this library, run:

$ npm install ionic-swing --save

Usage

1. Import the IonicSwingModule

In your app.module.ts, import the library like following:

import {IonicSwingModule} from 'ionic-swing';

and add it to your imports:

imports: [
    ...
    IonicSwingModule
    ...
]

2. To implement a card stack

To implement a card stack, follow the example provided by angular2-swing https://github.com/ksachdeva/angular2-swing

Or you could find also another example in my mobile application Fluster, see the following page and module https://github.com/fluster/fluster-app/tree/master/src/app/pages/browse/items/items

3. ViewChild and ViewChildren in Ionic v4

In Ionic v4, in order to access the stack and cards as ViewChild and ViewChildren, it's mandatory to use the keyword read to identify correctly the elements

Html:

<div swingStack #swingStack>
     <ion-card swingCard #swingCards>
     </ion-card>
</div>

Ts:

@ViewChild('swingStack', {read: SwingStackDirective}) swingStack: SwingStackDirective;
@ViewChildren('swingCards', {read: SwingCardDirective}) swingCards: QueryList<SwingCardDirective>;

Notes regarding hammerjs

This library need hammerjs but isn't shipped with it because some framework, like Ionic v3, already include it in their own resources. If it isn't your case, you would need to install hammerjs in your project

$ npm install hammerjs --save

and add the following line to your app.component.ts

import 'hammerjs';

Note regarding global

If you would face the error ReferenceError: global is not defined at ionic-swing.js at runtime, this could be fixed by declaring the window to the global scope. To do so add you could add the following to your polyfill.ts:

(window as any).global = window;

Development

To generate the library using ng-packagr (https://github.com/dherges/ng-packagr)

$ npm run packagr

To test locally

$ cd dist
$ npm pack
$ cd /your-project-path/
$ npm install /relative-path-to-local-ionic-swing/dist/ionic-swing-0.0.0.tgz

License

MIT © David Dal Busco

4.1.1

5 years ago

4.1.0

5 years ago

4.0.0

5 years ago

3.0.0

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

2.0.0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago