Skip to content

Commit

Permalink
fix(masonry.restrict): change directive restriction to attribute-only
Browse files Browse the repository at this point in the history
The masonry directive does not properly create columns when used as an element.  To avoid confusion,
I updated the directive code to restrict usage to attribute mode only (this could always be changed
back, if a subsequent fix was made to fix element loading). I have also updated the repository
README documentation to provide a more accurate account of how the masonry directive currently
works. This issue was first brought up here: passy#169.

This will invalidate uses of this directive as an element. However, these uses are likely already
broken.
  • Loading branch information
blakerego committed Mar 12, 2017
1 parent 80c5332 commit d01ca00
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ directive.
*Example:*

```html
<masonry item-selector=".mybrick">
<div masonry item-selector=".mybrick">
<div masonry-brick class="mybrick">Unicorns</div>
<div masonry-brick class="mybrick">Sparkles</div>
</masonry>
</div>
```

### `column-width`
Expand All @@ -81,9 +81,9 @@ not set, Masonry will use the outer width of the first element.
*Example:*

```html
<masonry column-width="200">
<div masonry column-width="200">
<div class="masonry-brick">This will be 200px wide max.</div>
</masonry>
</div>
```

### `preserve-order`
Expand All @@ -96,10 +96,10 @@ elements isn't set at the time they are inserted.
*Example:*

```html
<masonry preserve-order>
<div masonry preserve-order>
<div class="masonry-brick"><img src="..." alt="Will always be shown 1st"></div>
<div class="masonry-brick"><img src="..." alt="Will always be shown 2nd"></div>
</masonry>
</div>
```

### `load-images`
Expand All @@ -109,10 +109,10 @@ Allows usage of `imagesLoaded` plugin. Defaults to `false`.
*Example:*

```html
<masonry load-images="true">
<div masonry load-images="true">
<div class="masonry-brick"><img src="/your/image_1.jpg" alt="image"/></div>
<div class="masonry-brick"><img src="/your/image_2.jpg" alt="image"/></div>
</masonry>
</div>
```

### `reload-on-show`
Expand All @@ -125,10 +125,10 @@ hidden it may not render properly when shown again.
*Example:*

```html
<masonry reload-on-show ng-show="showList">
<div masonry reload-on-show ng-show="showList">
<div class="masonry-brick">...</div>
<div class="masonry-brick">...</div>
</masonry>
</div>
```

When `showList` changes from falsey to truthy `ctrl.reload` will be called.
Expand All @@ -144,10 +144,10 @@ some blank space may be left on the sides.
*Example:*

```html
<masonry reload-on-resize>
<div masonry reload-on-resize>
<div class="masonry-brick">...</div>
<div class="masonry-brick">...</div>
</masonry>
</div>
```


Expand All @@ -159,8 +159,8 @@ as expression either as `masonry` or `masonry-options` attribute.
*Example:*

```html
<masonry masonry-options="{ transitionDuration: '0.4s' }">
</masonry>
<div masonry masonry-options="{ transitionDuration: '0.4s' }">
</div>
```

Equivalent to:
Expand Down
2 changes: 1 addition & 1 deletion src/angular-masonry.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

}).directive('masonry', function masonryDirective() {
return {
restrict: 'AE',
restrict: 'A',
controller: 'MasonryCtrl',
controllerAs: 'msnry',
link: {
Expand Down

0 comments on commit d01ca00

Please sign in to comment.