https://github.com/ng-util/lazy
Project transferred to https://github.com/ng-util/ng-util/blob/master/packages/lazy/README.md
https://github.com/ng-util/lazy
angular angular-utility
Last synced: 11 months ago
JSON representation
Project transferred to https://github.com/ng-util/ng-util/blob/master/packages/lazy/README.md
- Host: GitHub
- URL: https://github.com/ng-util/lazy
- Owner: ng-util
- License: mit
- Archived: true
- Created: 2018-12-14T08:17:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-29T13:18:21.000Z (about 7 years ago)
- Last Synced: 2025-04-18T21:32:07.758Z (12 months ago)
- Topics: angular, angular-utility
- Language: TypeScript
- Homepage:
- Size: 228 KB
- Stars: 11
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# nu-lazy
---
Lazy load resources for Angular
[](https://www.npmjs.com/package/nu-lazy)
[](https://travis-ci.org/ng-util/lazy)
[](https://codecov.io/gh/ng-util/lazy)
## Demo
- [Live Demo](https://cipchk.github.io/nu-lazy/)
- [Stackblitz](https://stackblitz.com/edit/nu-lazy)
## Install
[](https://npmjs.org/package/nu-lazy)
## Usage
```typescript
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](https://stackblitz.com/edit/nu-lazy).
## API
| name | type | description |
| ---- | -- | ----------- |
| `events` | `Observable` | Events change callback |
| `clear()` | `void` | Clean all cached items |
| `load(paths: string | string[])` | `Promise` | Load the specified resources, includes `.js`, `.css` |
| `loadScript(path: string)` | `Promise` | Load a script resources |
| `loadStyle(path: string)` | `Promise` | Load a style resources |
## License
nu-lazy is released under the MIT license.