Skip to content

Add support for unpacking packery object and emit packery instance with its hash. #34

@tshi0912

Description

@tshi0912

Firstly, It's a great angular module which can fulfill the packery packing functions in angular fashion.
However, when using this module, I find some defects:

  1. Can not remove packery item when the relative data object deleted from collection. We often change our data model collection, say, add data items or remove data items, and angular will adjust the DOM nodes correspondingly. As you known, even if DOM nodes removed, the packery will keep them in the layout until we manually call packery.remove() function or packery.reloadItems() before packery.layout().
  2. $emit "packeryInstantiated" without hash to identify with which $scope this instance should be associated. I think the purpose you $emit "packeryInstantiated" event is giving outer $scope a chance to capture the packery instance for later using, say, invoking packery.layout() to re-layout as necessary. However if the app have multiple packery instances, the outer scope can not identify which $scope it should associated in the event handler. To resolve the issue, we can bind a predefined hash to the "packery" directive, and once the $rootScope capture the "packeryInstantiated" event, the outer $scope can measure whether this instance is the associated one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions