I am getting this error repeatedly, for one and another module.
ListProjectCategoryRoutingModule
Looks like:
import { NgModule } from '@angular/core';
import { AuthGuard } from '../../../../../helpers/auth.gaurd';
import { Role } from '../../../../../data/schema/role';
import { Routes, RouterModule } from '@angular/router';
import { ListProjectCategoryComponent } from './list-project-category.component';
const routes: Routes = [{ path: 'admin/projects/projectCategory/list',
component: ListProjectCategoryComponent
//canActivate: [AuthGuard],
//data: { roles: [Role.Admin]}
}];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ListProjectCategoryRoutingModule { }
ListProjectCategoryComponent
Looks like:
import { DetailsProjectCategoryComponent } from '../details-project-category/details-project-category.component';
import { Observable } from "rxjs";
import { ProjectsCategoryService } from "../../../../../data/service/projectsCategory.service";
import { ProjectsCategory } from "../../../../../data/schema/projects";
import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router';
@Component({
selector: "app-list-project-category",
templateUrl: "./list-project-category.component.html",
styleUrls: ["./list-project-category.component.css"]
})
export class ListProjectCategoryComponent implements OnInit {
projectsCategory: Observable<ProjectsCategory[]>;
constructor(private projectsCategoryService: ProjectsCategoryService,
private router: Router) {}
ngOnInit() {
this.reloadData();
}
reloadData() {
this.projectsCategory = this.projectsCategoryService.getProjectsCategorysList();
}
deleteProjectsCategory(id: number) {
this.projectsCategoryService.deleteProjectsCategory(id)
.subscribe(
data => {
console.log(data);
this.reloadData();
},
error => console.log(error));
}
// employeeDetails(id: number){
// this.router.navigate(['details', id]);
//}
}
I called it it from html file, Home
, Admin
, Projects
pages are navigating properly but i am getting error in ProjectCategory
page
<div *ngIf="isAdmin">
<nav class="navbar navbar-expand navbar-dark bg-dark" *ngIf="user">
<div class="navbar-nav">
<a class="nav-item nav-link" routerLink="/admin/home">Home</a>
<a class="nav-item nav-link" routerLink="/admin" *ngIf="isAdmin">Admin</a>
<a class="nav-item nav-link" routerLink="/admin/projects">Projects</a>
<a class="nav-item nav-link" routerLink="/admin/projects/projectssCategory/list">List Project Category</a>
<a class="nav-item nav-link" (click)="logout()">Logout</a>
</div>
</nav>
</div>
I have to add more modules similar to ListProjectCategory
Have added their route in app.routing.ts
and it is working fine for other modules
{ path: '', loadChildren: () => import('./modules/admin/project-folder/projectCategory/list-project-category/list-project-category.module').then(m => m.ListProjectCategoryModule) },
You have path
routerLink="/admin/projects/projectssCategory/list"
But routes expect
admin/projects/projectCategory/list
Just merge expect and real results
I think problem with projectssCategory where double s