Metafizzy Flickity for Angular
- Update to Angular 15.0
- Update to Angular 14.0
- Added a staticClick event emmiter (thanks paimfp)
- Fix triggers change detection unnecessary (thanks paimfp)
- Update to Angular 13.0
- Update to Angular 12.2
- Update dependencies
- Update to Angular 12
npm install ngx-metafizzy-flickity --save
npm install flickity --save
Add flickity in angular.json (since Angular 10)
"build": {
...
"options": {
...
"styles": [
"src/styles.scss",
"node_modules/flickity/dist/flickity.css"
],
"allowedCommonJsDependencies": ["flickity"]
},
...
},
Import FlickityModule
into your app's modules:
import { FlickityModule } from 'ngx-metafizzy-flickity';
@NgModule({
imports: [
FlickityModule
]
})
@Component({
selector: "my-component",
template: `
<div flickity>
<div *ngFor="let child of children">{{ child.title }}</div>
</div>
`,
})
class MyComponent {
children = [{ title: "Child 1" }, { title: "Child 2" }, { title: "Child 3" }];
}
Read about Flickity options here: https://flickity.metafizzy.co/options.html
Inline object:
<div
flickity
[flickityConfig]="{cellAlign: 'left', percentPosition: true, groupCells: true}"
></div>
@Input() flickityConfig: Flickity.Options = {
groupCells: true,
cellAlign: 'center',
pageDots: true,
draggable: true,
prevNextButtons: true,
};
Triggered after flickity is ready.
Triggered after page is changed.
click: EventEmitter<{event: PointerEvent, pointer: PointerEvent, cellElement: string, cellIndex: number}>
Triggered after click an element.
<div flickity (change)="onChange($event)" (click)="onClick($event)"></div>
ng serve