# angular-2-local-storage

> LocalStorageService for Angular 2 with mostly the same API (and most of the code) from angular-local-storage

Latest version **3.0.2** (published 2019-02-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular-2-local-storage
pnpm add angular-2-local-storage
yarn add angular-2-local-storage
bun add angular-2-local-storage
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2019-02-21 |
| First published | 2016-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 199.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 91 |
| Author | Craig Spence |
| Maintainers | elwyn, elwynelwyn, phenomnomnominal |

## Links

- npm: https://www.npmjs.com/package/angular-2-local-storage
- Repository: https://github.com/phenomnomnominal/angular-2-local-storage
- Homepage: https://github.com/phenomnomnominal/angular-2-local-storage#readme
- Issues: https://github.com/phenomnomnominal/angular-2-local-storage/issues
- npm.io page: https://npm.io/package/angular-2-local-storage

## Dependencies (1)

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

## Recent versions

- 3.0.2 (latest) — 2019-02-21
- 3.0.1 — 2019-02-18
- 3.0.0 — 2019-01-25
- 2.0.1 — 2019-01-25
- 2.0.0 — 2018-05-04
- 1.0.2 — 2018-05-02
- 1.0.1 — 2017-01-26
- 1.0.0 — 2016-12-10
- 0.1.0-beta.0 — 2016-12-10
- 0.0.25 — 2016-12-10
- 0.0.24 — 2016-12-09
- 0.0.23 — 2016-11-18
- 0.0.22 — 2016-11-09
- 0.0.21 — 2016-11-09
- 0.0.20 — 2016-10-13
- … 13 more at https://npm.io/package/angular-2-local-storage/versions

## README

# angular-2-local-storage

LocalStorageService for Angular with mostly the same API (and most of the code) from [angular-local-storage](https://github.com/grevory/angular-local-storage).

AoT compatible.

## Differences

* No events broadcast on $rootScope - LocalStorageService exposes observables for `errors$`, `removeItems$`, `setItems$` and `warning$` if you really need something to happen when something happens.
* The `bind` function doesn't work anymore (there is a stub so this can still be a drop-in, but it'll do nothing).

## Install

`npm install angular-2-local-storage`

## Usage

You can optionally configure the module:

```typescript
import { LocalStorageModule } from 'angular-2-local-storage';

@NgModule({
    imports: [
        LocalStorageModule.forRoot({
            prefix: 'my-app',
            storageType: 'localStorage'
        })
    ],
    declarations: [
        ..
    ],
    providers: [
        ..
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }
```

Then you can use it in a component:

```typescript
import { LocalStorageService } from 'angular-2-local-storage';

@Component({
    // ...
})
export class SomeComponent {
    constructor (
        private _localStorageService: LocalStorageService
    ) {
        // YAY!
    }
}

```

### Configuration options

`import { ILocalStorageServiceConfig } from 'angular-2-local-storage';` for type information about the configuration object.

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