1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

URL changes but components not rendered in Angular

Discussão em 'Angular' iniciado por ayman omara, Setembro 29, 2024.

  1. ayman omara

    ayman omara Guest

    I am new to angular I am mobile developer , I am using angular 17 but I have issue the only home page renders on the screen I can't navigate to any other component the url changes but the same page appears

    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { AppRoutingModule } from './app-routing.module';
    import { HttpClientModule } from '@angular/common/http';
    import { EmployeesComponent } from './employee/employees/employees-component/employees-component';
    import { EmployeesService } from './employee/common/employees-service';
    import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
    import { MatTableModule } from '@angular/material/table';
    import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
    import { LoadingComponent } from './core/compnents/loading-component';
    import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
    import { AddEmployeeComponent } from './employee/add-employee.ts/add-employee-component';

    @NgModule({
    declarations: [EmployeesComponent, LoadingComponent, AddEmployeeComponent],
    imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    MatTableModule,
    MatProgressSpinnerModule,
    BrowserAnimationsModule,
    ],
    providers: [EmployeesService, provideAnimationsAsync('animations')],
    bootstrap: [AddEmployeeComponent],
    })
    export class AppModule {}


    app router

    import { NgModule } from '@angular/core';
    import { RouterModule, Routes } from '@angular/router';
    import { AddEmployeeComponent } from './employee/add-employee.ts/add-employee-component';
    import { EmployeesComponent } from './employee/employees/employees-component/employees-component';
    export const routes: Routes = [
    {
    path: 'add',
    component: EmployeesComponent,
    },
    {
    path: '',
    component: AddEmployeeComponent,
    },
    ];

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


    I added

    but still networking when I created my project I enabled option to use app modules

    Continue reading...

Compartilhe esta Página