ng-tiny-url
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

NgTinyUrl

An angular library to shorten url using TinyUrl api. Works on angular version 6+

Installation

To install this library, run:

$ npm install ng-tiny-url

Usage

import {NgTinyUrlModule} from 'ng-tiny-url';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgTinyUrlModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Once imported in your module, inject the NgTinyUrlService into your component as shown below:

import {NgTinyUrlService} from 'ng-tiny-url';


export class AppComponent {
  title = 'tinyUrlTest';
  shortenedUrl = '';

  constructor(private tinyUrl: NgTinyUrlService) {
      this.tinyUrl.shorten('www.google.com').subscribe(res => {
        this.shortenedUrl = res;
        console.log(res); // https://tinyurl.com/8wa5w2o;
      });
    }
}

License

MIT © Kelvin Esekhile

/ng-tiny-url/

    Package Sidebar

    Install

    npm i ng-tiny-url

    Weekly Downloads

    190

    Version

    1.0.2

    License

    none

    Unpacked Size

    21.6 kB

    Total Files

    17

    Last publish

    Collaborators

    • cozmik05