@@ -254,7 +254,6 @@ To get a list using the list of content files in the `src/content` folder, use t
254254import { Component } from ' @angular/core' ;
255255import { RouterLink , RouterOutlet } from ' @angular/router' ;
256256import { injectContentFiles } from ' @analogjs/content' ;
257- import { NgFor } from ' @angular/common' ;
258257
259258export interface PostAttributes {
260259 title: string ;
@@ -265,14 +264,18 @@ export interface PostAttributes {
265264
266265@Component ({
267266 standalone: true ,
268- imports: [RouterOutlet , RouterLink , NgFor ],
267+ imports: [RouterOutlet , RouterLink ],
269268 template: `
270269 <ul>
271- <li *ngFor="let post of posts">
272- <a [routerLink]="['/blog', 'posts', post.slug]">{{
273- post.attributes.title
274- }}</a>
275- </li>
270+ @for (post of posts; track post.slug) {
271+ <li>
272+ <a [routerLink]="['/blog', 'posts', post.slug]">
273+ {{ post.attributes.title }}
274+ </a>
275+ </li>
276+ } @empty {
277+ <li>No posts yet.</li>
278+ }
276279 </ul>
277280 ` ,
278281})
@@ -292,7 +295,7 @@ The `injectContent()` function uses the `slug` route parameter by default to get
292295``` ts
293296// /src/app/pages/blog/posts.[slug].page.ts
294297import { injectContent , MarkdownComponent } from ' @analogjs/content' ;
295- import { AsyncPipe , NgIf } from ' @angular/common' ;
298+ import { AsyncPipe } from ' @angular/common' ;
296299import { Component } from ' @angular/core' ;
297300
298301export interface PostAttributes {
@@ -304,12 +307,12 @@ export interface PostAttributes {
304307
305308@Component ({
306309 standalone: true ,
307- imports: [MarkdownComponent , AsyncPipe , NgIf ],
310+ imports: [MarkdownComponent , AsyncPipe ],
308311 template: `
309- <ng-container *ngIf=" post$ | async as post">
312+ @if ( post$ | async; as post) {
310313 <h1>{{ post.attributes.title }}</h1>
311314 <analog-markdown [content]="post.content"></analog-markdown>
312- </ng-container>
315+ }
313316 ` ,
314317})
315318export default class BlogPostComponent {
@@ -429,12 +432,12 @@ export interface ProjectAttributes {
429432
430433@Component ({
431434 standalone: true ,
432- imports: [MarkdownComponent , AsyncPipe , NgIf ],
435+ imports: [MarkdownComponent , AsyncPipe ],
433436 template: `
434- <ng-container *ngIf=" project$ | async as project">
437+ @if ( project$ | async; as project) {
435438 <h1>{{ project.attributes.title }}</h1>
436439 <analog-markdown [content]="project.content"></analog-markdown>
437- </ng-container>
440+ }
438441 ` ,
439442})
440443export default class ProjectComponent {
0 commit comments