5.4.0 • Published 5 years ago
ngx-take-until-destroy v5.4.0
🤓 Angular - Unsubscribe For Pros 💪
Declarative way to unsubscribe from observables when the component destroyed
Installation
npm install ngx-take-until-destroy --save
Usage
import { untilDestroyed } from 'ngx-take-until-destroy';
@Component({
selector: 'app-inbox',
templateUrl: './inbox.component.html',
})
export class InboxComponent implements OnInit, OnDestroy {
ngOnInit() {
interval(1000)
.pipe(untilDestroyed(this))
.subscribe(val => console.log(val));
}
// This method must be present, even if empty.
ngOnDestroy() {
// To protect you, we'll throw an error if it doesn't exist.
}
}
Use with any class
import { untilDestroyed } from 'ngx-take-until-destroy';
export class Widget {
constructor() {
interval(1000)
.pipe(untilDestroyed(this, 'destroy'))
.subscribe(console.log);
}
// The name needs to be the same as the decorator parameter
destroy() {}
}
5.4.0
5 years ago
5.3.1
5 years ago
5.3.0
5 years ago
5.2.3
6 years ago
5.2.2
6 years ago
5.2.1
6 years ago
5.2.0
6 years ago
5.1.0
6 years ago
5.0.0
6 years ago
4.1.2
6 years ago
4.1.1
6 years ago
4.1.0
6 years ago
4.0.1
6 years ago
4.0.0
6 years ago
3.0.0
6 years ago
2.2.1
6 years ago
2.2.0
6 years ago
2.1.1
6 years ago
2.1.0
6 years ago
2.0.1
6 years ago
2.0.0
6 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.0
6 years ago