Warum wird Modul 2 in Modul 1 angezeigt?Verwenden der Winkelkomponentenführung in verschiedenen Modulen
Wir haben eine eckige App, die mehrere Module enthält. Für einige Module möchten wir einen Komponenten-Router verwenden. Wir wissen nicht, auf welcher Seite (URL) die Komponente geladen wird.
Aktuelle Situation: In Modul 1 werden die Vorlagen für Modul 2 angezeigt.
Gewünschtes Ergebnis: Haben Pfade relativ zu der Komponente, so dass '... com/someUrlWhereModule1Lives #/Schritt 2' Lasten 2 des Moduls Schritt 1
' ... com/someUrlWhereModule2Lives #/Schritt 2' Lasten Schritt 2 des Moduls 2
module1.module.js
angular
.module('app.module1', ['ngComponentRouter'])
.value('$routerRootComponent', 'module1')
.component('module1', {
templateUrl: 'module1.overview.html',
$routeConfig: [
{path: '/', name: 'Overview', component: 'module1Step1', useAsDefault: true},
{path: '/step2', name: 'Overview', component: 'module1Step2'}
]
})
.component('module1Step1', {
bindings: { $router: '<' },
templateUrl: 'module1.step1.html'
})
.component('module1Step2', {
bindings: { $router: '<' },
templateUrl: 'module1.step2.html'
});
module2.module.js
angular
.module('app.module2', ['ngComponentRouter'])
.value('$routerRootComponent', 'module2')
.component('module2', {
templateUrl: 'module2.overview.html',
$routeConfig: [
{path: '/', name: 'Overview', component: 'module2Step1', useAsDefault: true},
{path: '/step2', name: 'Step2', component: 'module2Step2'}
]
})
.component('module2Step1', {
bindings: { $router: '<' },
templateUrl: 'module2.step1.html'
})
.component('module2Step2', {
bindings: { $router: '<' },
templateUrl: 'module2.step2.html'
});
Wenn mehr Informationen benötigt werden, lassen Sie es mich wissen.