Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

app.component.ts

57 lines1.2 KB

1import { ChangeDetectionStrategy, Component } from '@angular/core'
2import { PostsComponent } from './components/posts.component'
3​
4@Component({
5 changeDetection: ChangeDetectionStrategy.OnPush,
6 selector: 'ssr-example',
7 imports: [PostsComponent],
8 template: `
9 <main class="page">
10 <header class="hero">
11 <p class="eyebrow">Angular SSR</p>
12 <h1>Server-rendered posts with TanStack Query</h1>
13 <p class="lede">
14 The first render comes from the server. Angular then hydrates the app
15 on the client and TanStack Query continues from a fresh client cache.
16 </p>
17 </header>
18​
19 <posts />
20 </main>
21 `,
22 styles: `
23 .page {
24 max-width: 960px;
25 margin: 0 auto;
26 padding: 48px 20px 72px;
27 }
28​
29 .hero {
30 margin-bottom: 32px;
31 }
32​
33 .eyebrow {
34 margin: 0 0 8px;
35 font-size: 12px;
36 font-weight: 700;
37 letter-spacing: 0.12em;
38 text-transform: uppercase;
39 color: #9b5c00;
40 }
41​
42 h1 {
43 margin: 0 0 12px;
44 font-size: clamp(2.2rem, 5vw, 4rem);
45 line-height: 1;
46 }
47​
48 .lede {
49 max-width: 640px;
50 margin: 0;
51 font-size: 1rem;
52 line-height: 1.6;
53 color: #4b5563;
54 }
55 `,
56})
57export class SsrExampleComponent {}