File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
docs/framework/angular/guides Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,28 @@ export class QueriesService {
3131
3232// usage:
3333
34+ postId = input .required ({
35+ transform: numberAttribute ,
36+ })
3437queries = inject (QueriesService )
3538
36- injectQuery (this .queries .post (1 ))
37- injectQueries ({
38- queries: [this .queries .post (1 ), this .queries .post (2 )],
39- })
39+ postQuery = injectQuery (() => this .queries .post (this .postId ()))
40+
4041queryClient .prefetchQuery (this .queries .post (23 ))
41- queryClient .setQueryData (this .queries .post (42 ).queryKey , newGroups )
42+ queryClient .setQueryData (this .queries .post (42 ).queryKey , newPost )
4243```
4344
4445[ // ] : # ' Example1 '
46+ [ // ] : # ' Example2 '
47+
48+ ``` ts
49+ // Type inference still works, so query.data will be the return type of select instead of queryFn
50+ queries = inject (QueriesService )
51+
52+ query = injectQuery (() => ({
53+ ... groupOptions (1 ),
54+ select : (data ) => data .title ,
55+ }))
56+ ```
57+
58+ [ // ] : # ' Example2 '
You can’t perform that action at this time.
0 commit comments