jelgblad / angular2-masonry

https://github.com/desandro/masonry module for Angular2
101 stars 48 forks source link

Add ability to handle external actions #10

Closed zaikin-andrew closed 8 years ago

zaikin-andrew commented 8 years ago

Hi. Could you add ability to use public method after external actions? Like here

$grid.on( 'click', '.grid-item', function() {
  // change size of item via class
  $( this ).toggleClass('grid-item--gigante');
  // trigger layout
  $grid.masonry();
});

We use $grid.masonry(); for adapting grid to current state.

jelgblad commented 8 years ago

In angular2 you can access all public function on a component either by

<masonry #myMasonry>
  <masonry-brick (click)="myMasonry.layout()"></masonry-brick>
</masonry>
@ViewChild(AngularMasonry) private masonry: AngularMasonry;

myClickHandler(){
  this.masonry.layout();
}
zaikin-andrew commented 8 years ago

Thank you! :)

AbhayVel commented 8 years ago

Hi jelgblad,

Thanks a lot, Please close this issue.