Skip to content

Commit

Permalink
Allow the component to be destroyed
Browse files Browse the repository at this point in the history
This fix the javascript errors, ObjectUnsubscribedError,
that were thrown when navigating away from a page with
the progress bar to a page without the progress bar.

Fixes MurhafSousli#27
Fixes MurhafSousli#28
Fixes MurhafSousli#33
Fixes MurhafSousli#41
Fixes MurhafSousli#81
Fixes MurhafSousli#82
  • Loading branch information
PowerKiKi committed Oct 25, 2017
1 parent 25b60c4 commit 04e4afb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import { NgProgressModule } from 'ngx-progressbar';
})
```

In your root component **(or any component that does not get destroyed)!**
In your template

```html
<ng-progress></ng-progress>
Expand Down
9 changes: 2 additions & 7 deletions src/components/progress.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
Component, Input, ChangeDetectionStrategy, OnChanges, SimpleChanges, OnDestroy
Component, Input, ChangeDetectionStrategy, OnChanges, SimpleChanges
} from '@angular/core';
import { NgProgressService } from '../services/progress.service';

Expand All @@ -25,7 +25,7 @@ import { NgProgressService } from '../services/progress.service';
changeDetection: ChangeDetectionStrategy.OnPush
})

export class ProgressComponent implements OnChanges, OnDestroy {
export class ProgressComponent implements OnChanges {

/** Progress options */
@Input() ease = 'linear';
Expand Down Expand Up @@ -95,9 +95,4 @@ export class ProgressComponent implements OnChanges, OnDestroy {
}
}

ngOnDestroy() {
this.progress.state.unsubscribe();
this.progress.trickling.unsubscribe();
}

}

0 comments on commit 04e4afb

Please sign in to comment.