0

In a hybrid (AngularJs + Angular) angular application, I want to load a component (say ExampleComponent) if the URL prefix starts with /test. Let's say, I want to load the ExampleComponent each time if any of the below url is hit.

  • /test
  • /test/a/b?c=test
  • /test/a/b
  • /test/2222
  • /test/....
import { NgModule } from '@angular/core';
import { UIRouterUpgradeModule } from '@uirouter/angular-hybrid';
import { ExampleComponent } from './example.component';

@NgModule({
  imports: [
    UIRouterUpgradeModule.forChild(
      { 
        states: [
          {
            parent: 'Home',
            name: "test",
            url: "/test",
            component: ExampleComponent,
            permissions: []
          }
        ] 
      }
    ),
  ],
  declarations: [ExampleComponent],
})
export class ExampleModule {}

I have researched this a bit (https://github.com/ui-router/angular-hybrid) but unfortunately didn't find any workable solution. Can anyone please let me know whether is it possible in the hybrid router? TIA

pcghose
  • 179
  • 16

0 Answers0