Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c5e8d2d

Browse filesBrowse files
committed
refactor(demos): remove programmatic usage of ngOnDestroy
1 parent b5a893a commit c5e8d2d
Copy full SHA for c5e8d2d

File tree

3 files changed

+9
-12
lines changed
Filter options

3 files changed

+9
-12
lines changed

‎apps/demos/src/app/features/tutorials/basics/5-side-effects/side-effects.solution.component.ts

Copy file name to clipboardExpand all lines: apps/demos/src/app/features/tutorials/basics/5-side-effects/side-effects.solution.component.ts
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
ChangeDetectionStrategy,
33
Component,
44
Input,
5-
OnDestroy,
65
OnInit,
76
Output,
87
} from '@angular/core';
@@ -74,7 +73,7 @@ const initComponentState = {
7473
})
7574
export class SideEffectsSolution
7675
extends RxState<ComponentState>
77-
implements OnInit, OnDestroy
76+
implements OnInit
7877
{
7978
model$ = this.select();
8079

‎apps/demos/src/app/shared/debug-helper/value-provider/primitives-provider.service.ts

Copy file name to clipboardExpand all lines: apps/demos/src/app/shared/debug-helper/value-provider/primitives-provider.service.ts
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export class PrimitivesProviderService {
5959
};
6060

6161
private resetObservables = () => {
62-
this.state.ngOnDestroy();
6362
runInInjectionContext(
6463
this.injector,
6564
() => (this.state = new RxState<ProvidedValues>()),

‎apps/demos/src/app/shared/viewport.service.ts

Copy file name to clipboardExpand all lines: apps/demos/src/app/shared/viewport.service.ts
+8-9Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
import { BreakpointObserver, Breakpoints, BreakpointState } from '@angular/cdk/layout';
2-
import { Injectable, OnDestroy } from '@angular/core';
1+
import {
2+
BreakpointObserver,
3+
Breakpoints,
4+
BreakpointState,
5+
} from '@angular/cdk/layout';
6+
import { Injectable } from '@angular/core';
37
import { RxState } from '@rx-angular/state';
48
import { distinctUntilChanged, map } from 'rxjs/operators';
59

@@ -20,7 +24,7 @@ interface ViewportServiceState {
2024
@Injectable({
2125
providedIn: 'root',
2226
})
23-
export class ViewportService implements OnDestroy {
27+
export class ViewportService {
2428
private readonly state = new RxState<ViewportServiceState>();
2529

2630
readonly viewport$ = this.state.select('viewport');
@@ -52,15 +56,10 @@ export class ViewportService implements OnDestroy {
5256
);
5357
this.state.connect(viewport$, (oldState, viewportChange) => ({
5458
viewport: viewportChange,
55-
isHandset:
56-
viewportChange === 'mobile' || viewportChange === 'tablet',
59+
isHandset: viewportChange === 'mobile' || viewportChange === 'tablet',
5760
isMobile: viewportChange === 'mobile',
5861
isTablet: viewportChange === 'tablet',
5962
isDesktop: viewportChange === 'desktop',
6063
}));
6164
}
62-
63-
ngOnDestroy() {
64-
this.state.ngOnDestroy();
65-
}
6665
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.