Configuration
You can now define operations on your routes. In the following example code, you see a simple getMany
population for the PostsIndexComponent
. We also define one child route for the selected Post entity.
Use the operate()
function to define operators for your routes.
import { getActive, getMany, reset } from '@ng-frrri/router-middleware/operators';
const all = 'entities';
const posts = 'entities.posts';
const routes: Routes = [
{
path: '',
pathMatch: 'full',
redirectTo: 'all',
},
{
path: 'all',
component: PostsIndexComponent,
data: operate(
reset(all),
getMany(posts),
),
children: [{
path: ':id',
component: PostsShowComponent,
data: operate(
getActive(posts),
),
}],
},
];
@NgModule({
imports: [
RouterModule.forChild(
frrri(routes),
),
],
exports: [RouterModule],
})
export class PostsRoutingModule { }
Last updated