Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/leifermendez/swipe-angular-list

You can now have a swipe effect on your angle application, with which you can place delete or edit options. Ideal for task list or contacts
https://github.com/leifermendez/swipe-angular-list

angular angular-cli pwa swipe swipe-gestures

Last synced: 3 months ago
JSON representation

You can now have a swipe effect on your angle application, with which you can place delete or edit options. Ideal for task list or contacts

Awesome Lists containing this project

README

        

![](https://img.shields.io/npm/dy/swipe-angular-list.svg)
![](https://img.shields.io/github/stars/leifermendez/swipe-angular-list)
![](https://img.shields.io/github/license/leifermendez/swipe-angular-list)
# Angular Swiper List (swipe-angular-list)

You can now have a swipe effect on your Angular application, with which you can place delete or edit options. Ideal for task list or contacts.

__[VER DEMO](https://stackblitz.com/edit/angular-ejzvpz)__

Buy Me A Coffee


Preview


Preview 1

----


Examples

Preview 1
Preview 2
Preview 3

### Install

`npm i swipe-angular-list@latest --save`

### Import

__main.ts__

Import `hammerjs`

```typescript

import './polyfills';
import 'hammerjs'; // < ----- ******************************** IMPORT
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

```

__app.module.ts__

```typescript

import { BrowserModule, HammerModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { AppComponent } from "./app.component";

import { SwipeAngularListModule } from "swipe-angular-list"; // <------ IMPORT

@NgModule({
declarations: [AppComponent],

imports: [
BrowserModule,
HammerModule, // < ----- ******************************** IMPORTANT ******************
SwipeAngularListModule, // < ----- ******************************** IMPORTANT ******************
],

providers: [],

bootstrap: [AppComponent],
})
export class AppModule {}

```
__style.css__
> The scroll doesn't work on mobile devices?
```css
* {
touch-action: pan-y !important;
}
```

### Use

Use in your component

```typescript

import { Component } from "@angular/core";

@Component({
selector: "app-root",

templateUrl: "./app.component.html",

styleUrls: ["./app.component.css"],
})
export class AppComponent {
title = "for-test";

list = [
{
id: 1,
title: "Realizar la tarea asignada!",
subTitle: "9:00pm",
},
{
id: 2,
title: "Visitar al perro en casa de tu amiga",
subTitle: "9:00pm",
},
{
id: 3,
title: "Llamar al doctor",
subTitle: "9:00pm",
},
{
id: 4,
title: "Buscar el auto en el taller",
subTitle: "9:00pm",
}
];

action = (a) => {
console.log(a);
};

swipeCallback = (a) => {
console.log('Callback Swipe', a);
}
}

```

### Template

```html


Task List





!<-- Defined yout template for icon button (edit)-->

!<-- Defined yout template for icon button (trash)-->

```

### Options

__item__ structure defined :

``` text
{
"id":1,
"title":"Realizar la tarea asignada!",
"subTitle":"9:00pm"
}

```
### Inputs
| Name | Default | Description |
|:----------:|:-------------:|:------:|
| item-class | (string) '' | name of style class custom |
| show-mark | (boolean) true | boolean show icon done or not |
| editTemplate | (TemplateRef) or null | template for edit button |
| trashTemplate | (TemplateRef) or null | template for trash button |
| markTemplate | (TemplateRef) | template for icon check template |
| notMarkTemplat | (TemplateRef) | template for icon not check template |

### Output
| Name | Default | Description |
|:----------:|:-------------:|:------:|
| (callback) | (function) | function callback click option |
| (swClick) | (function) | click on item |
| (swipeCb) | (function) | function callback swipe item |

``` html

```

#### Example completed
```html


TASK LIST











Lorem, ipsum dolor.



Lorem ipsum dolor sit amet consectetur adipisicing elit. Non,optio.


```