klederson / angular-masonry-directive

A very simple and 100% compatible masonry directive for AngularJS ... do you know how to use masonry? Good! You know how to use this
115 stars 68 forks source link

ReferenceError: imagesLoaded is not defined #39

Open iamjinme opened 8 years ago

iamjinme commented 8 years ago

I try, but received this error on console. My code is:

<div class="grid">
<div masonry='{ "transitionDuration" : "0.4s" , "itemSelector" : ".tile", "columnWidth" : 160 }'>
  <div class="grid-item" masonry-tile ng-repeat="item in items">
    <img ng-src="{{ item.src }}" class="img-responsive" onerror="this.src='/public/img/404.jpg'"/>

Any idea?

iamjinme commented 8 years ago

Update: I add ImagesLoad library to index.html

<script src="https://npmcdn.com/imagesloaded@4.1/imagesloaded.pkgd.js"></script>

Now the error is: TypeError: elem.get is not a function On line 58:

imagesLoaded( elem.get(0), update);

What is the problem? Please.

iamjinme commented 8 years ago

I solve the problem. Replace "elem.get(0)" with "elem.eq(0)".

jingzhou123 commented 7 years ago

elem.get is a jQuery method not angular jqLite method

MrSpark2591 commented 7 years ago

<script src="https://npmcdn.com/imagesloaded@4.1/imagesloaded.pkgd.js"></script>

try including this one if you are using jquery..:)