Using vanilla-lazyload 10.15.0 loadAll method in AngularJS 1.6

327 views Asked by At

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.

0

There are 0 answers