8. POST (crear)

8.2. Componente de formulario

ng g c pages/post-form --standalone

Y lo añadimos a la ruta (posts/new debe ir antes que posts/:id)

src/app/app.routes.ts

import { PostFormComponent } from './pages/post-form/post-form.component';

export const routes: Routes = [
  { path: '', redirectTo: 'posts', pathMatch: 'full' },
  { path: 'posts', component: PostsListComponent },
  { path: 'posts/new', component: PostFormComponent },   // Aquí
  { path: 'posts/:id', component: PostDetailComponent },
  { path: '**', redirectTo: 'posts' },
];