Skip to content

Instantly share code, notes, and snippets.

@gparlakov
Created February 11, 2018 11:13
Show Gist options
  • Save gparlakov/080ece78188893c8d4287fc8810c6a56 to your computer and use it in GitHub Desktop.
Save gparlakov/080ece78188893c8d4287fc8810c6a56 to your computer and use it in GitHub Desktop.
2. Workaround
@Injectable()
export class TimeService {
// ... some useful stuff
onDestroy(): void {
// ... some clean up logic
}
}
@Component({/*... omitted for brevity*/})
export class TimeWidgetComponent implements OnDestroy{
constructor(private timeService: TimeService) {
// useful stuff using timeService
}
ngOnDestroy() {
this.timeService.onDestroy();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment