0

I'm really new to angular and I started in an existent project using vanilla-lazyload to lazy load images, and for the application logic I need to use the method loadAll of the documentation, but when I run "bower install vanilla-lazyload#^10.15.0 --save" y can use only the functions update(), destroy(), and handleScroll(), which appear in the lazyload.d.ts inside the folder bower_components, I don't know why I can't use the other methods. I try to modificate the file adding the method, does not work. The lazyload.d.ts looks

interface ILazyLoadOptions {
    threshold?: number;
    container?: HTMLElement;
    elements_selector?: any;
    throttle?: number;
    data_src?: string;
    data_srcset?: string;
    class_loading?: string;
    class_loaded?: string;
    class_error?: string;
    skip_invisible?: boolean;
    show_while_loading?: boolean;
    callback_set?: (elt:HTMLImageElement) => void;
    callback_load?: (elt:HTMLImageElement) => void;
    callback_error?: (elt:HTMLImageElement) => void;
    callback_processed?: (elts:HTMLImageElement[]) => void;
    placeholder?: string;
}
interface ILazyLoad {
    new (options?: ILazyLoadOptions);
    update();
    destroy();
    handleScroll();
}
declare var LazyLoad: ILazyLoad; 

And I have in the index.run.js

$rootScope.lazyLoadImage = new LazyLoad.default({
    // example of options object -> see options section
    threshold: 500,
    throttle: 200,
    elements_selector:'img.lazy',
    callback_load: (e) => {
      angular.element(e).parent().find('.img-loading-container').fadeOut();
    },
    callback_error: (e) => {
      angular.element(e).parent().find('.img-loading-container').fadeOut();
      angular.element(e).parent().find('.img-loading-container-error').fadeIn();
      angular.element(e).fadeOut();
    }
  });

Anyone can tell me what I'm missing here?

If the question is ambiguous tell me and I can be more specific. Sorry for my poor English.

2
  • yes, sorry about that, is angular 1.6 Commented Aug 17, 2018 at 19:17
  • One of the common reasons jQuery plugins have problems is that the element doesn't exist when the plugin searches for a target element. AngularJS builds and destroys DOM in the course of its operation. To help us understand the problem, we need a Minimal, Complete, and Verifiable example. Commented Aug 18, 2018 at 19:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.