Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug(ngOnDestroy): add an if statement to make sure this.subscription is
Browse files Browse the repository at this point in the history
defined

This simply allows navigation away from a route using this package which
is not currently happening every time.

Closes #46
dockleryxk authored and DethAriel committed Aug 18, 2017
1 parent d1f62e9 commit 9cc48ab
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion recaptcha/recaptcha-loader.service.ts
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ export class RecaptchaLoaderService {
/** @internal */
private language: string;

constructor( @Optional() @Inject(RECAPTCHA_LANGUAGE) language?: string) {
constructor(@Optional() @Inject(RECAPTCHA_LANGUAGE) language?: string) {
this.language = language;
this.init();
this.ready = RecaptchaLoaderService.ready.asObservable();
4 changes: 3 additions & 1 deletion recaptcha/recaptcha.component.ts
Original file line number Diff line number Diff line change
@@ -59,7 +59,9 @@ export class RecaptchaComponent implements AfterViewInit, OnDestroy {
// reset the captcha to ensure it does not leave anything behind
// after the component is no longer needed
this.grecaptchaReset();
this.subscription.unsubscribe();
if (this.subscription) {
this.subscription.unsubscribe();
}
}

/**

0 comments on commit 9cc48ab

Please sign in to comment.