I'm trying to work with 3 components:
A component that will be as a border to the Login / Log component, the registry component (RegistrarComponent), and the login component (LoginComponent).
In my app.module is set to start through the appComponent:
bootstrap: [AppComponent]
In the routes of app.routing.module I tried to define it this way:
const appRoutes: Routes = [
{path: '', loadChildren: 'src/app/components/entrar-app/entrarapp.module#EntrarModule'},
{path: 'home', loadChildren: 'src/app/components/home/home.module#HomeModule'},
];
That is, when you hit the default URL, redirect to the module that will make up the other components.
In my enterappcomponent I put in the template the border and the router-outlet that should change between the login and registration screen (starting at the login screen):
<div class="background-total">
<router-outlet></router-outlet>
</div>
The content of the background-div div is loaded, however I can not configure this router-outlet to show the login / registration component in there.
I tried something like:
LoginAppRoutingModule.ts:
const routes: Routes = [
{
path: '',
component: EntrarAppComponent,
},
{path: '', loadChildren: 'src/app/components/entrar-app/login/login.module#LoginModule'},
];
I've also tried:
{
path: '',
component: EntrarAppComponent,
},
{path: '', redirectTo: 'login'},
{path: 'login', loadChildren: 'src/app/components/entrar-app/login/login.module#LoginModule' }
];
Of these two forms the div is rendered but does not redirect to the route / login.