Socket
Socket
Sign inDemoInstall

angular2-take-until-destroy

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-take-until-destroy

Add take until component destroy for easy unsubscribe when the component destroyed


Version published
Weekly downloads
25
increased by92.31%
Maintainers
1
Weekly downloads
 
Created
Source

Angular 2 - easy unsubscribe when component destroyed

Angular 2 decorator - easy and declarative way to unsubscribe from observables when the component destroyed

Installation

npm install angular2-take-until-destroy --save

Usage

import TakeUntilDestroy from "angular2-take-until-destroy";

@Component({
  selector: 'app-inbox',
  templateUrl: './inbox.component.html'
})
@TakeUntilDestroy
export class InboxComponent {
  constructor( ) {
    const timer$ = Observable.interval(1000)
      .takeUntil((<any>this).componentDestroy())
      .subscribe(val => console.log(val))
  }

  ngOnDestroy() {
    // You can also do whatever you need here
  }

}

FAQs

Package last updated on 06 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc