Skip to content
This repository was archived by the owner on May 10, 2020. It is now read-only.

ng-util/lazy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jan 29, 2019
0aa128d · Jan 29, 2019

History

3 Commits
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Jan 29, 2019
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018
Dec 14, 2018

Repository files navigation

nu-lazy


Lazy load resources for Angular

NPM version Build Status Codecov

Demo

Install

nu-lazy

Usage

import { LazyService } from 'nu-lazy';

export class AppComponent {
  constructor(private srv: LazyService) { }

  async loadBS() {
    const res = await this.srv.load(`https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css`);
    console.log(`bootstrap`, res);
  }

How to use it with:

  • Stackblitz sample available here.

API

name type description
events Observable<LazyResult[]> Events change callback
clear() void Clean all cached items
load(paths: string | string[]) Promise<LazyResult[]> Load the specified resources, includes .js, .css
loadScript(path: string) Promise<LazyResult> Load a script resources
loadStyle(path: string) Promise<LazyResult> Load a style resources

License

nu-lazy is released under the MIT license.