Skip to content

Commit 53c95c0

Browse files
committed
Change readme
1 parent ac19c5d commit 53c95c0

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,32 @@
33

44
Load external javascript libraries/files (e.g. Google Maps JavaScript API, Stripe JavaScript API, ...) in your components and services on the fly (when you need them) and execute code as soon as it's loaded.
55

6+
## Introduction
7+
There are mainly two options to include a javascript library into your Angular project:
8+
- Add it via the package manager ``npm``
9+
- Include it in your ``index.html`` file
10+
11+
However, sometimes
12+
- You don't want to include it upfront in your application to reduce size
13+
and thus initial loading time of your application.
14+
- An appropriate ``npm`` package does not exist and you
15+
don't want to add the library to ``index.html``.
16+
17+
18+
🌟 This library provides a service to lazy load javascript libraries when you need them,
19+
one a component and service basis.
20+
21+
#### Features
22+
- Provides an Angular service to load javascript files.
23+
- The service loads each library only once, i.e. remembers which libraries were already loaded.
24+
- You can subscribe to the returned observable to execute code relying on the lazy loaded script.
25+
626
## Installation
727
Using npm:
828
```
929
npm i --save @ueler/ng-lazyload-script
1030
```
1131

12-
## Features
13-
- Provides an Angular service to load javascript files.
14-
- The service loads each library only once, i.e. remembers which libraries were already loaded.
15-
- You can subscribe to the returned observable to execute code relying on the lazy loaded script.
16-
1732
## How does it work?
1833
The service creates a ``<script>`` tag with the provided source url and appends it to the document body.
1934

0 commit comments

Comments
 (0)