html5 - Router Outlet displays more than 1 component -
i having trouble seting navigation of app. reason router outlet have set keeps displaying components after clicking routerlink component, show them on after other , if keep clicking de links tables(thats components are) displayed 1 more time on view.
that's sidenav:
<ul id="sidenav" class="side-nav"> <li> <div class="square " id="logocontainer"> <img src="../../assets/img/{{brand}}logo.jpg" id="logo" class="backimg"> </div> </li> <li><a routerlink="/admregiones">inicio<i class="material-icons">home</i></a> </li> <ul class="collapsible collapsible-accordion"> <li> <a class="collapsible-header">regiones<i class="material-icons" style="padding-left: 15px">terrain</i></a> <div class="collapsible-body"> <ul> <li><a routerlink="/admregiones" class="waves-effect waves-blue"><i class="material-icons right" style="padding-left: 10px">add_location</i> administrar regiones </a></li> </ul> </div> </li> </ul> <li class="no-padding"> <ul class="collapsible collapsible-accordion"> <li> <a class="collapsible-header">locaciones<i class="material-icons" style="padding-left: 15px">map</i></a> <div class="collapsible-body"> <ul> <li><a routerlink="/buscarlocacion" class="waves-effect waves-blue"><i class="material-icons right" style="padding-left: 10px">location_searching</i>ir locación </a></li> <li><a routerlink="/admlocaciones" class="waves-effect waves-blue"><i class="material-icons right" style="padding-left: 10px">add_location</i> administrar locaciones </a></li> </ul> </div> </li> </ul> </li> </ul>
this routes:
routermodule.forroot([ { path: 'admlocaciones', component: admlocacionescomponent }, { path: 'buscarlocacion', component: buscarlocacioncomponent }, { path: 'admregiones', component: admregionescomponent } ])
here component display(both admregiones , admlocaciones practically same):
<div class="container col s8"style="padding-top: 4%;"> <a href="#modalnuevalocacion" class="waves-effect waves-light btn modal-trigger" (click)="openmodal(); exportedinitialize();">modal</a> <table class="highlight striped center" id="tablalocaciones" onload="loadtablalocaciones()"> <hr> <thead> <tr> <th>id</th> <th>nombre</th> <th>región</th> <th>editar</th> <th>eliminar</th> </tr> </thead> <tbody id="locacionesbody"> </tbody> </table> </div>
and app-component template:
<app-header></app-header> <div id="body"> <router-outlet></router-outlet> </div> <app-locacion></app-locacion> <app-side-nav></app-side-nav>
Comments
Post a Comment