I'm building a custom CMS with Angular2 and I have two types of posts (let's call them typeA
and typeB
) that are identical except for this type property.
I'd like to reuse my PostListComponent
and PostEditorComponent
for both types but those having a different URL.
I was thinking on adding to my RouteDefinition[]
(I'm still using 2.0.0-rc.2
with @angular/router-deprecated
):
{
path : '/admin/type-a',
name : 'Type A Post List',
component : PostListComponent,
arguments : { 'type' : 'typeA' }
}, {
path : '/admin/type-b',
name : 'Type B Post List',
component : PostListComponent,
arguments : { 'type' : 'typeB' }
}
But I can't find any documentation on how to pass this default argument to a Component. On SO I've just found this related answer, but it's not the same issue and I wouldn't like to be using a workaround like that.
Any hint will be much appreciated!