import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { AuthGuard } from '../auth/auth-guard.service'; import { ProductGroupListResolver } from '../product-group/product-group-list-resolver.service'; import { RecipeDetailComponent } from './recipe-detail/recipe-detail.component'; import { RecipeListResolver } from './recipe-list-resolver.service'; import { RecipeListComponent } from './recipe-list/recipe-list.component'; import { RecipeResolver } from './recipe-resolver.service'; const recipeRoutes: Routes = [ { path: '', component: RecipeListComponent, canActivate: [AuthGuard], data: { permission: 'Recipes', }, resolve: { list: RecipeListResolver, productGroups: ProductGroupListResolver, }, }, { path: 'new', component: RecipeDetailComponent, canActivate: [AuthGuard], data: { permission: 'Recipes', }, resolve: { item: RecipeResolver, }, }, { path: ':id', component: RecipeDetailComponent, canActivate: [AuthGuard], data: { permission: 'Recipes', }, resolve: { item: RecipeResolver, }, }, ]; @NgModule({ imports: [CommonModule, RouterModule.forChild(recipeRoutes)], exports: [RouterModule], providers: [RecipeListResolver, RecipeResolver], }) export class RecipeRoutingModule {}