Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,8 @@
"to": "framework/angular/examples/infinite-query-with-max-pages"
},
{
"label": "Default Query Function",
"to": "framework/angular/examples/default-query-function"
"label": "Angular Router",
"to": "framework/angular/examples/router"
}
]
}
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions examples/angular/default-query-function/.eslintrc.cjs

This file was deleted.

6 changes: 0 additions & 6 deletions examples/angular/default-query-function/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions examples/angular/default-query-function/index.html

This file was deleted.

26 changes: 0 additions & 26 deletions examples/angular/default-query-function/package.json

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions examples/angular/default-query-function/src/index.ts

This file was deleted.

27 changes: 0 additions & 27 deletions examples/angular/default-query-function/tsconfig.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ExampleComponent {

query = injectInfiniteQuery(() => ({
queryKey: ['projects'],
queryFn: async ({ pageParam }) => {
queryFn: ({ pageParam }) => {
return lastValueFrom(this.projectsService.getProjects(pageParam))
},
initialPageParam: 0,
Expand Down
3 changes: 2 additions & 1 deletion examples/angular/router/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "pnpm"
"packageManager": "pnpm",
"analytics": false
},
"newProjectRoot": "projects",
"projects": {
Expand Down
10 changes: 5 additions & 5 deletions examples/angular/router/src/app/components/post.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {
ChangeDetectionStrategy,
Component,
EventEmitter,
Output,
inject,
input,
numberAttribute,
} from '@angular/core'
import { RouterLink } from '@angular/router'
import {
Expand All @@ -23,15 +22,16 @@ import { PostsService } from '../services/posts-service'
})
export default class PostComponent {
#postsService = inject(PostsService)
queryClient = injectQueryClient()

postId = input<number, string>(0, {
transform: (value: string) => Number(value),
postId = input(0, {
transform: numberAttribute,
})

postQuery = injectQuery(() => ({
enabled: this.postId() > 0,
queryKey: ['post', this.postId()],
queryFn: async () => {
queryFn: () => {
return lastValueFrom(this.#postsService.postById$(this.postId()))
},
}))
Expand Down
2 changes: 1 addition & 1 deletion examples/angular/simple/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Simple example
# Angular Query simple example

To run this example:

Expand Down
3 changes: 2 additions & 1 deletion examples/angular/simple/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "pnpm"
"packageManager": "pnpm",
"analytics": false
},
"newProjectRoot": "projects",
"projects": {
Expand Down
4 changes: 2 additions & 2 deletions examples/angular/simple/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple",
"version": "0.0.0",
"name": "@tanstack/query-example-angular-simple",
"type": "module",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
37 changes: 0 additions & 37 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.