Answer the question
In order to leave comments, you need to log in
How to design the correct structure of Angular components?
Installed Angular from CLI, with standard structure. When the entry point is a file:
app.module -> app.component The app.component.html
template file has
<router-outlet>
</router-outlet>
and the site skeleton, which should be visible only after authorization. Answer the question
In order to leave comments, you need to log in
It can be done differently. One of the ways out: it is
necessary to register in the routing something like this:
const appRoutes: Routes = [
{ path: '', redirectTo: '/login', pathMatch: 'full' },
{ path: 'login', component: LoginComponent },
{ path: 'main', component: MainComponent}
auth() {
this.service.getToken(this.login, this.password).then(res) {
if (res) {
return this.router.navigate(['/main']);
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question