Package Exports
- ng-lz-string
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ng-lz-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ng-lz-string
An Angular wrapper for lz-string. Built and tested for Angular 4. Should work for > Angular 4.
Installation
To install this library, run:
$ npm install ng-lz-string --save
Usage
Here's how you can use this library in your Angular app:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// Import your library
import { LZStringModule, LZStringService } from 'ng-lz-string';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
// Specify the LZ String Module as an import
LZStringModule
],
providers: [
// Specify the service in the providers section
LZStringService
],
bootstrap: [AppComponent]
})
export class AppModule { }
Once your library is imported in your module, you can use it in your Angular application:
import {LZStringService} from 'ng-lz-string';
export class AppComponent implements OnInit {
constructor(private lz: LZStringService){
}
performCompressionAndDecompression(){
const compressed = this.lz.compress('This is going to be compressed');
console.log(compressed);
const decompressed = this.lz.decompress(compressed);
console.log(decompressed);
}
}