How to set up routes in angular

Discussão em 'Angular' iniciado por Callistron, Novembro 23, 2024.

  1. Callistron

    Callistron Guest

    So i've been following along a tutorial for some basic angular stuff but i ran into a problem which i cant figure out.

    The code i copied from the tutorial looks like this:

    import {NgModule} from '@angular/core';
    import { RouterModule, Routes } from '@angular/router';
    import { BeszerzesEszkozSelectorComponent } from './components/pages/beszerzes-eszkoz-selector/beszerzes-eszkoz-selector.component';
    import { LoginComponent } from './components/pages/login/login.component';

    const routes: Routes = [
    {path: '' , component:LoginComponent},
    {path: 'beszerzes', component:BeszerzesEszkozSelectorComponent}
    ];

    @NgModule({
    imports:[RouterModule.forRoot(routes)],
    exports:[RouterModule]
    })
    export class AppRoutingModule{}


    and then it talks about how i can use the <router-outlet> tag in the app.html file and that should in this case default for my login component but for me i just get an error message saying router-outlet is not a known element.

    So if anyone knows how to solve this it would be much appreciated.

    Continue reading...

Compartilhe esta Página