Working on a small Angular 2 app for an AbyssRium game calculator, I am attempting to repurpose a basic component that displays a list of items. My goal is to have these components display only a specific subset of elements based on filtering by group.
I'm exploring the possibility of achieving this through RouteConfig (by passing a parameter), although I'm not entirely certain if it's feasible. I've been trying to grasp the concept of 'Routes' from the documentation (here and here) but so far, I haven't come across any clear references (currently experimenting with Resolve without much success). This is what I envision:
@RouteConfig([
{path: '/corals', name: 'Corals', component: ItemsList, data:{group:'coral'}, useAsDefault: true},
{path: '/fishes', name: 'Fishes', component: ItemsList, data:{group:'fish'}},
])
In addition, I attempted to create submodules (ItemsList -> ItemsCoralList & ItemsFishList) and set the class initialization (this.group = "coral") in the constructor, yet encountered numerous compilation errors:
Cannot resolve 'xxx'. Make sure they all have valid type or annotations.
Any suggestions on how to achieve this without duplicating the entire code?
You can find the code snippet on Plunker