1 import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { PluginService } from '@app/core'
6 templateUrl: './plugin-pages.component.html'
8 export class PluginPagesComponent implements AfterViewInit {
9 @ViewChild('root') root: ElementRef
12 private route: ActivatedRoute,
13 private router: Router,
14 private pluginService: PluginService
20 const path = '/' + this.route.snapshot.url.map(u => u.path).join('/')
22 const registered = this.pluginService.getRegisteredClientRoute(path)
24 console.log('Could not find registered route %s.', path, this.pluginService.getAllRegisteredClientRoutes())
26 return this.router.navigate([ '/404' ], { skipLocationChange: true })
29 registered.onMount({ rootEl: this.root.nativeElement })