# ngx-source

> Angular resource loader

Latest version **18.0.0** (published 2025-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngx-source
pnpm add ngx-source
yarn add ngx-source
bun add ngx-source
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 18.0.0 |
| Published | 2025-07-21 |
| First published | 2020-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 30.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sajad Mehrabi |
| Maintainers | mehrabisajad |
| Keywords | ngx, ng, nga, avan, angular, soure loader, resoure loader, library, ngx resoure loader |

## Links

- npm: https://www.npmjs.com/package/ngx-source
- Repository: https://github.com/mehrabisajad/ngx-source
- Homepage: https://github.com/mehrabisajad/ngx-source#readme
- Issues: https://github.com/mehrabisajad/ngx-source/issues
- npm.io page: https://npm.io/package/ngx-source

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 18.0.0 (latest) — 2025-07-21
- 13.0.2 — 2023-11-21
- 1.3.1 — 2020-11-02
- 1.3.0 — 2020-07-27
- 1.2.0 — 2020-07-27
- 1.1.0 — 2020-07-25
- 1.0.3 — 2020-07-25
- 1.0.2 — 2020-07-25
- 1.0.1 — 2020-07-24
- 1.0.0 — 2020-07-24

## README

# ngx source

angular source, can load js and css in runtime

[![npm version](https://badge.fury.io/js/ngx-source.svg)](http://badge.fury.io/js/ngx-source)
[![GitHub issues](https://img.shields.io/github/issues/mehrabisajad/ngx-source.svg)](https://github.com/mehrabisajad/ngx-source/issues)
[![GitHub stars](https://img.shields.io/github/stars/mehrabisajad/ngx-source.svg)](https://github.com/mehrabisajad/ngx-source/stargazers)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/mehrabisajad/ngx-source/master/LICENSE)

## Installation

Install through npm:

```
npm install --save ngx-source
```

use in one of your apps components:

```typescript
import { Component, OnInit } from '@angular/core';
import { Source, SourceType, NgxSourceService } from 'ngx-source';

@Component({
  template: 'your-component',
})
export class YourComponent implements OnInit {
  constructor(private ngxSourceService: NgxSourceService) {
    this.ngxSourceService.addSources([
      new Source('yourJsName', '/js/yourJsFile.js', SourceType.SCRIPT),
      new Source('yourCssName', '/css/yourCssFile.js', SourceType.STYLE),
    ]);
  }

  async ngOnInit() {
    await this.ngxSourceService.loadBySourceName('yourJsName');
    await this.ngxSourceService.loadBySourceName('yourCssName');

    // or

    await this.ngxSourceService.loadBySourceNames('yourJsName', 'yourCssName');
  }
}
```

---
_Source: https://npm.io/package/ngx-source · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
