Menu option back to login

Asked

Viewed 38 times

0

I’m trying to use Adminlte treeview in the system menu, but every time I click on the menu item it goes back to login.

For example:

When I click on Dashboard, Graphics or Management, it goes back to login

Excerpt from treeview in HTML:

<li class="treeview">
  <a href="#">
    <i class="fa fa-power-off"></i>
    <span>Gerenciamento</span>
    <span class="pull-right-container">
       <i class="fa fa-angle-left pull-right"></i>
    </span>
  </a>
  <ul class="treeview-menu">
    <li class="treeview">
      <a>
        <i class="fa fa-circle-o"></i><span>Digiboard</span>
        <span class="pull-right-container">
           <i class="fa fa-angle-left pull-right"></i>
        </span>
      </a>
      <ul class="treeview-menu">
        <li><a routerLinkActive="ative" [routerLink]="['/gerenciar-dispositivo']"><i class="fa fa-circle"></i>Gerenciamento de dispositivos</a></li>
      </ul>
    </li>
  </ul>
</li>

This is the menu:

inserir a descrição da imagem aqui

Routes:

export const ROUTES: Routes = [
  {
    path: 'sistema',
    component: LayoutComponent,
    children: [
      {path: 'estacao', loadChildren: './estacao/estacao.module#EstacaoModule' },
      {path: 'gerenciar-dispositivo', loadChildren: './gerenciar-dispositivos/gerenciar-dispositivos.module#GerenciarDispositivosModule'}
    ]
  },
  {path: '', component: LoginComponent},
  {path: ':to', component: LoginComponent}
 ]

Every time I click on the menu it goes back to the login, why?

  • Have you tried placing a preventDefault() in the link to?

  • well, in this case it stopped working, I tried so: <a (click)="$event.preventDefault()">

  • I don’t know much about JS, but I think preventDefault() is a stopPropagation() manager... or is it all the same thing? I suggested this because I’ve seen some menus in JS that when you click a with href="#"the screen scrolled to the top and solved using preventDefault()

  • It’s that I’m using angular and not js

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.