How do I generate Angular route configurations dynamically/pragmatically?
问题 Hi I am trying to define the Angular 2 route paths pragmatically. I have a service that returns the paths, all the paths use a common component for routing the service is shown below, (all paths are generated dynamically) export class PagesService{ getPages() :string[] { return [{"slug": 'john',"name": 'John'},{"slug": 'martin',"name": 'Martin'},{"slug": 'alex',"name": 'Alex'},{"slug": 'susan',"name": 'Susan'}] } } The routing component, @Component({ selector : 'app', template : ` <router