@@ -16,9 +16,9 @@ import { ProjectsService } from '../services/projects.service'
16
16
imports : [ ProjectStyleDirective ] ,
17
17
} )
18
18
export class ExampleComponent {
19
- projectsService = inject ( ProjectsService )
19
+ readonly projectsService = inject ( ProjectsService )
20
20
21
- query = injectInfiniteQuery ( ( ) => ( {
21
+ readonly query = injectInfiniteQuery ( ( ) => ( {
22
22
queryKey : [ 'projects' ] ,
23
23
queryFn : ( { pageParam } ) => {
24
24
return lastValueFrom ( this . projectsService . getProjects ( pageParam ) )
@@ -29,29 +29,31 @@ export class ExampleComponent {
29
29
maxPages : 3 ,
30
30
} ) )
31
31
32
- nextButtonDisabled = computed (
32
+ readonly nextButtonDisabled = computed (
33
33
( ) => ! this . #hasNextPage( ) || this . #isFetchingNextPage( ) ,
34
34
)
35
- nextButtonText = computed ( ( ) =>
35
+
36
+ readonly nextButtonText = computed ( ( ) =>
36
37
this . #isFetchingNextPage( )
37
38
? 'Loading more...'
38
39
: this . #hasNextPage( )
39
40
? 'Load newer'
40
41
: 'Nothing more to load' ,
41
42
)
42
- previousButtonDisabled = computed (
43
+
44
+ readonly previousButtonDisabled = computed (
43
45
( ) => ! this . #hasPreviousPage( ) || this . #isFetchingNextPage( ) ,
44
46
)
45
- previousButtonText = computed ( ( ) =>
47
+ readonly previousButtonText = computed ( ( ) =>
46
48
this . #isFetchingPreviousPage( )
47
49
? 'Loading more...'
48
50
: this . #hasPreviousPage( )
49
51
? 'Load Older'
50
52
: 'Nothing more to load' ,
51
53
)
52
54
53
- #hasPreviousPage = this . query . hasPreviousPage
54
- #hasNextPage = this . query . hasNextPage
55
- #isFetchingPreviousPage = this . query . isFetchingPreviousPage
56
- #isFetchingNextPage = this . query . isFetchingNextPage
55
+ readonly #hasPreviousPage = this . query . hasPreviousPage
56
+ readonly #hasNextPage = this . query . hasNextPage
57
+ readonly #isFetchingPreviousPage = this . query . isFetchingPreviousPage
58
+ readonly #isFetchingNextPage = this . query . isFetchingNextPage
57
59
}
0 commit comments