Masonry module for Angular2
angular2-masonry is in development and not ready for production use. Feel free to install and try it out, but depend on it at your own risk.
Installation
npm install angular2-masonry --save
If you're using SystemJS add angular2-masonry
and masonry-layout
to your configuration:
packages: ,map:
Usage
Import MasonryModule
into your app's modules:
;
Configuration
Options
Read about Masonry options here: http://masonry.desandro.com/options.html
The options
-attribute takes an object with the following properties:
- itemSelector: string;
- columnWidth: number | string;
- gutter: number;
- percentPosition: boolean;
- stamp: string;
- fitWidth: boolean;
- originLeft: boolean;
- originTop: boolean;
- containerStyle: string;
- transitionDuration: string;
- resize: boolean;
- initLayout: boolean;
Examples
Inline object:
From parent component:
; public myOptions: MasonryOptions = transitionDuration: '0.8s' ;
imagesLoaded
NOTE: Will throw error if global
imagesLoaded
not available.
Delay adding brick until all images in brick are loaded.
To activate imagesLoaded set useImagesLoaded
to true
.
index.html:
Events
EventEmitter<any[]>
layoutComplete: Triggered after a layout and all positioning transitions have completed.
EventEmitter<any[]>
removeComplete: Triggered after an item element has been removed.
Examples