Last active
February 11, 2018 12:00
-
-
Save gparlakov/ebc9a64507dd025b80a3872db56a37b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable() | |
export class TimeService implements OnDestroy { | |
// ... some useful stuff | |
ngOnDestroy(): void { | |
// ... some clean up logic | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
providers: [ | |
TimeService | |
] | |
}) | |
export class FeedComponent { | |
constructor(timeService: TimeService) { | |
// useful stuff using timeService | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Service gets its ngOnDestroy called when component is destroyed. Even when it itself does not have the ngOnDestroy method.