Search code examples
angulartypescriptangular-routing

why doesn't the the Routes recognize te component


i'm creating a Portfolio for myself and im using Angular 12 for it. i have problems with Routing although i went through all the <angular.io> instruction. i'm creating an stack Blitz for better demonstration My Portfolio

the aboutme component do not show after i click on the about me link in the app.component


Solution

  • You make mistake in your routing module I fixed that and you make mistake in your selector in AboutMe component

    import { NgModule } from '@angular/core';
    import { RouterModule, Routes } from '@angular/router';
    import { AboutMeComponent } from './aboutme/aboutme.component';
    
    const routes: Routes = [{ path: 'aboutme', component: AboutMeComponent }];
    
    @NgModule({
      imports: [RouterModule.forRoot(routes)],
      exports: []
    })
    export class AppRoutingModule {}