Sub-Routing (Angular): Unterschied zwischen den Versionen

Aus Tutorials
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „ Zurück zu Angular“)
 
Zeile 1: Zeile 1:
{{note|Noch in Bearbeitung}}
== Sub-Route anlegen ==
<pre>
import ...
const routes: Routes = [
  {
    path: '',
    redirectTo: 'main',
    pathMatch: 'full'
  },
  {
    path: 'main',
    component: MainComponent,
    children: [
      {
        path: '',
        redirectTo: 'subtarget1',
        pathMatch: 'full'
      },
      {
        path: 'subtarget1',
        component: SubTarget1Component,
        outlet: 'sub'
      },
      {
        path: 'subtarget1',
        component: SubTarget1Component,
        outlet: 'sub'
      }
    ]
  }
];
@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class TestRoutingModule { }
</pre>




Zurück zu [[Angular#Routing|Angular]]
Zurück zu [[Angular#Routing|Angular]]

Version vom 30. November 2018, 11:58 Uhr

Noch in Bearbeitung


Sub-Route anlegen

import ...

const routes: Routes = [
  {
    path: '',
    redirectTo: 'main',
    pathMatch: 'full'
  },
  {
    path: 'main',
    component: MainComponent,
    children: [
      {
        path: '',
        redirectTo: 'subtarget1',
        pathMatch: 'full'
      },
      {
        path: 'subtarget1',
        component: SubTarget1Component,
        outlet: 'sub'
      },
      {
        path: 'subtarget1',
        component: SubTarget1Component,
        outlet: 'sub'
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class TestRoutingModule { }


Zurück zu Angular