Router Outlet displays more than 1 component - html

I am having trouble seting up the navigation of my app. For some reason the router outlet i have set keeps displaying the components even after clicking a routerlink to another component, it just show them on after the other and if i keep clicking de links the tables(thats what my components are) just are displayed one more time on the view.
That's my 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 a 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 my routes:
RouterModule.forRoot([
{
path: 'admLocaciones',
component: AdmLocacionesComponent
},
{
path: 'buscarLocacion',
component: BuscarLocacionComponent
},
{
path: 'admRegiones',
component: AdmRegionesComponent
}
])
Here my component to display(both admRegiones and admLocaciones are practically the same):
<div class="container col s8"style="padding-top: 4%;">
Modal <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 this my 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>

Related

How can I add a submenu to the sidenav in Materialize?

How can I add submenu to the following sidenav?
<ul class="sidenav sidenav-fixed" id="nav-mobile" style="width:250px">
<li> Text here</li>
<li>
<div class="divider"></div>
</li>
<li>
<a onclick="load('home')"><i class="material-icons">home</i>Home</a>
</li>
<li><a onclick="load('intro')"><i class="material-icons">apps</i>Content Table</a></li>
</ul>
MaterializeCSS documentation site uses a collapsible inside the sidenav:
https://materializecss.com/collapsible.html
Collapsible is a separate component that also needs initialising:
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.collapsible');
var instances = M.Collapsible.init(elems);
});
Working codepen:
https://codepen.io/doughballs/pen/RwPWVqy
The actual markup taken from the Materialize doc site is:
<!-- Start nested content -->
<li>
<ul class="collapsible collapsible-accordion">
<li>
<a class="collapsible-header waves-effect waves-teal" tabindex="0"><i class="material-icons">menu</i>Nested</a>
<div class="collapsible-body">
<ul>
<li>Color</li>
<li>Grid</li>
<li>Helpers</li>
<li>Media</li>
<li>Pulse</li>
<li>Sass</li>
<li>Shadow</li>
<li>Table</li>
<li>Transitions</li>
<li>Typography</li>
</ul>
</div>
</li>
</ul>
</li>
You can do something like below with MaterializeCSS
<div id="slide-out" class="sidenav" style="transform: translateX(0%);">
<ul class="collapsible">
<li class="active">
<div class="collapsible-header">
Group1
</div> <div class="collapsible-body" style="display: block;">
<li>Course 1</li>
<li>Course 2</li>
</div>
</li>
<li class="">
<div class="collapsible-header">
केंद्रीय लोकसेवा आयोग
</div>
<div class="collapsible-body" style="">
</div>
</li>
</ul>
</div>

DIV extending beyond parent DIV

I'm trying to keep a child DIV from extending over the parent....the DIV in question is the one seen below labeled with id="2".....it goes past the parent DIV and goes all the way to the bottom of the page/browser window. I've modified the height, adding padding, changed location of the DIV and nothing works....not sure what to try next:
<div id="2" style="width:15%; height:90%; padding:10px; background-color:#2A7FAA; float:right; margin-top:200px"></div>
<div style="background-color:#FFF; border:thick; border-width:thick;">
<div style="margin-left:250px;">
<img style="padding:2em;" alt="ASH Banner" src="images/banner.png" class="banner"> <img style="padding:2em;" alt="ASH Banner" src="images/dsh-logo.png" class="logo">
</div>
</div>
<div style="height:15px; background-color:#2A7FAA"></div>
<div style="margin-left:150px; background:#CCC">
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">HOME
</button>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">PERSONNEL
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">INSURANCE
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">WORKERS COMP
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">EMPLOYMENT<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="background-color:transparent">BENEFIT PREMIUMS<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</div>
</div>
<hr / style="border-width: 2px; width:800px; margin-right:9em;">
<div style="margin-top:3em">
<div style="width: 800px; margin: 0 auto;">
<p>Text Goes Here Text Goes Here Text Goes Here</p>
</div>
</div>
<div style="width: 800px; margin: 0 auto;">
<div class="cbox" style="left: 320px; top: 150px; width: 622px;">
<table>
<tr>
<td><img class="center" alt="" src="images/sponsor-dot.gif" width="15" /> <span onClick="openClose('a1')" style="cursor:hand; cursor:pointer; color: #33F; text-decoration:underline">Personnel Contacts</span>
<div id="a1" class="texter">
<ul class="style3">
<li class="listbox">Personnel Phone List</li>
<li class="listbox">Payroll Partners</li>
<li class="listbox">Personnel Specialist Work Assignments</li>
<li class="listbox">Work Area by Payroll Reporting Unit</li>
</ul>
</div>
</td>
</tr>
<tr>
<td><img class="center" alt="" src="images/sponsor-dot.gif" width="15" /> <span onClick="openClose('a2')" style="cursor:hand; cursor:pointer; color: #33F; text-decoration:underline">Insurance Information</span>
<div id="a2" class="texter">
<ul class="style3">
<li class="listbox"><a href='User_Area/HR/BenefitsWorksheet2017.pdf'>Benefits Worksheet </a></li>
<li class="listbox"><a href='http://eservices.calhr.ca.gov/BenefitsCalculatorExternal/'>Benefit Premium Calculator </a></li>
<li class="listbox"><a href='http://www.calhr.ca.gov/employees/pages/new-employee-benefits-orientation.aspx'>New Employee Benefits Orientation </a></li>
<li class="listbox"><a href='user_area/hr/HealthInsuranceMarketplaceCoverageOptions.pdf'>Health Insurance Marketplace Coverage Options </a></li>
<li class="listbox"><a href='user_area/hr/2018HighlightsAndChanges.pdf'>2018 Plan Highlights and Changes</a></li>
<li class="listbox"><a href='user_area/hr/DentalHandbook2017.pdf'>Dental Handbook 2017</a></li>
<li class="listbox"><a href='user_area/hr/DentalHandbook2018.pdf'>Dental Handbook 2018</a></li>
<li class="listbox"><a href='user_area/hr/CobenHandbook2017.pdf'>COBEN Handbook 2017</a></li>
<li class="listbox"><a href='user_area/hr/CobenHandbook2018.pdf'>COBEN Handbook 2018</a></li>
<li class="listbox"><a href='user_area/hr/FlexElectHandbook2017.pdf'>Flex Elect Handbook 2017</a></li>
<li class="listbox"><a href='user_area/hr/FlexElectHandbook2018.pdf'>Flex Elect Handbook 2018</a></li>
<li class="listbox"><a href='user_area/hr/Open_Enrollment_Event_Flyer.pdf'>2017-18 Open Enrollment Event 9/11/17 12pm-2pm</a></li>
<li class="listbox"><a href='user_area/hr/Open_Enrollment_Newsletter.pdf'>CalPERS 2017-18 Open Enrollment Newsletter</a></li>
</ul>
</div>
</td>
</tr>
<tr>
<td><img class="center" alt="" src="images/sponsor-dot.gif" width="15" /> <span onClick="openClose('a14')" style="cursor:hand; cursor:pointer; color: #33F; text-decoration:underline">Employment</span>
<div id="a14" class="texter">
<ul class="style3">
<li class="listbox">Training and Experience (T&E) Assessment Instructions</li>
<li class="listbox">Examination/Employment Application</li>
<li class="listbox">Exam Announcements</li>
<li class="listbox">Vacancy Listings</li>
<li class="listbox">CalHR Best Hiring Practices</li>
<li class="listbox">Authorization to Obtain Employment Reference Information</li>
<li class="listbox">Pre-Employment Reference Checklist</li>
</ul>
</div>
<p> </p>
</td>
</tr>
</table>
</div>
</div>

css not showing correctly asp.net mvc

hi i'm working on a admin template. I converted the html codes into mvc structure. Now i am stuck , when i create a page using the layout in the shared folder the footer goes up to the navigation bar. for more understanding check the screenshot
here is my _layoutadmin.cshtml
<div class="container body">
<div class="main_container">
<div class="col-md-3 left_col">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<i class="fa fa-paw"></i> <span>Admin Panel</span>
</div>
<div class="clearfix"></div>
<!-- menu prile quick info -->
<div class="profile">
<div class="profile_pic">
<img src="~/Content/admin/AdminLogo.jpg" alt="..." class="img-circle profile_img"/>
#*<img src="images/img.jpg" alt="..." class="img-circle profile_img">*#
</div>
<div class="profile_info">
<span>Welcome,</span>
<h2>John Doe</h2>
</div>
</div>
<!-- /menu prile quick info -->
<br />
<!-- sidebar menu -->
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<h3>General</h3>
<ul class="nav side-menu">
<li>
<a><i class="fa fa-home"></i> Home <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
Dashboard
</li>
<li>
Dashboard2
</li>
<li>
Dashboard3
</li>
</ul>
</li>
<li>
<a><i class="fa fa-edit"></i> Forms <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
General Form
</li>
<li>
Advanced Components
</li>
<li>
Form Validation
</li>
<li>
Form Wizard
</li>
<li>
Form Upload
</li>
<li>
Form Buttons
</li>
</ul>
</li>
<li>
<a><i class="fa fa-desktop"></i> UI Elements <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
General Elements
</li>
<li>
Media Gallery
</li>
<li>
Typography
</li>
<li>
Icons
</li>
<li>
Glyphicons
</li>
<li>
Widgets
</li>
<li>
Invoice
</li>
<li>
Inbox
</li>
<li>
Calender
</li>
</ul>
</li>
<li>
<a><i class="fa fa-table"></i> Tables <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
Tables
</li>
<li>
Table Dynamic
</li>
</ul>
</li>
<li>
<a><i class="fa fa-bar-chart-o"></i> Data Presentation <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
Chart JS
</li>
<li>
Chart JS2
</li>
<li>
Moris JS
</li>
<li>
ECharts
</li>
<li>
Other Charts
</li>
</ul>
</li>
</ul>
</div>
<div class="menu_section">
<h3>Live On</h3>
<ul class="nav side-menu">
<li>
<a><i class="fa fa-bug"></i> Additional Pages <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
E-commerce
</li>
<li>
Projects
</li>
<li>
Project Detail
</li>
<li>
Contacts
</li>
<li>
Profile
</li>
</ul>
</li>
<li>
<a><i class="fa fa-windows"></i> Extras <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li>
404 Error
</li>
<li>
500 Error
</li>
<li>
Plain Page
</li>
<li>
Login Page
</li>
<li>
Pricing Tables
</li>
</ul>
</li>
<li>
<a><i class="fa fa-laptop"></i> Landing Page <span class="label label-success pull-right">Coming Soon</span></a>
</li>
</ul>
</div>
</div>
<!-- /sidebar menu -->
</div>
</div>
<!-- top navigation -->
<div class="top_nav">
<div class="nav_menu">
<nav class="" role="navigation">
<div class="nav toggle">
<a id="menu_toggle"><i class="fa fa-bars"></i></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="images/img.jpg" alt="">John Doe
<span class=" fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu animated fadeInDown pull-right">
<li>
Profile
</li>
<li>
<a href="javascript:;">
<span class="badge bg-red pull-right">50%</span>
<span>Settings</span>
</a>
</li>
<li>
Help
</li>
<li>
<i class="fa fa-sign-out pull-right"></i> Log Out
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
<!-- /top navigation -->
<!-- page content -->
<div class="right_col" role="main">
<!-- top tiles -->
#RenderBody()
<!-- footer content -->
<footer>
<div class="copyright-info">
<p class="pull-right">
Gentelella - Bootstrap Admin Template by Colorlib
</p>
</div>
<div class="clearfix"></div>
</footer>
<!-- /footer content -->
</div>
<!-- /page content -->
</div>
</div>
<div id="custom_notifications" class="custom-notifications dsp_none">
<ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group"></ul>
<div class="clearfix"></div>
<div id="notif-group" class="tabbed_notifications"></div>
</div>
Using <footer> tag in HTML does not create a sticky bottom footer.
Have a look to this Bootstrap example

Getting the attribute value of anchor tag in UL

<div class="content">
<ul class="clean menu" id="topics">
<li class="drop png">
<div>
<span href="#" id="phone" style="BACKGROUND-POSITION: 13px -79px">Phone</span>
</div>
<ul class="clean menu sub">
<li>
<a cat="tech" class="sec_phone_0" href="javascript:void(0);" name="&lid=choose_category_phone_digital" rel="1">FiOS Digital Voice</a>
</li>
<li class="last">
<a cat="tech" class="sec_phone_1" href="javascript:void(0);" name="&lid=choose_category_phone_dialup" rel="1">Home Phone(Copper)</a>
</li>
<li class="last">
<a cat="tech" class="sec_phone_2" href="javascript:void(0);" name="&lid=choose_category_phone_fiosVoice" rel="1">FiOS Voice</a>
</li>
<li class="last" style="margin-bottom:7px;">
<a cat="tech" class="sec_phone_2" href="javascript:void();" name="&lid=choose_category_phone_wireless" rel="1">Verizon Wireless</a>
</li>
</ul>
</li>
</ul>
</div>
Now I need to select the "cat" value of Fios Voice. How can I do this in Mootools v1.3.2?
Need to set the value in cookie.
This script gets the property of link on click event.
window.addEvent('domready',function(){
$$('ul.sub')[0].getElements('a').each(function(el,ind){
el.addEvent('click',function(){
var cat = el.getProperty('cat');
alert(cat)
})
})
})
For case when <a cat="tech1" class="sec_phone_0 active" href="javascript:void(0);" name="&lid=choose_category_phone_digital" rel="1">FiOS Digital Voice</a> has class="active"
window.addEvent('domready',function(){
if($$('ul.sub')[0].getElements('a.active')[0]){
var cat = $$('ul.sub')[0].getElement('a.active').getProperty('cat');
alert(cat);
}
})

adding class active & removing default to the menu selected

I have created web application where I want to highlight the menu selected.
Below is what I have
<div style="width: 80%;" align="left" >
<span style="display:inline-block;" align="left" >
<div id="menubar" class="grid-block">
<nav id="menu">
<ul class="menu menu-dropdown ">
<li class="level1 item101 active">
<a href="index.xhtml" class="level1">
<span>
<span class="icon" style="background-image: url('images/menu/icon_menu_home.png');background-repeat: no-repeat; background-position: top center">
</span>
Home
</span>
</a>
</li>
<li class="level1 item102 parent makeSpace default"
style="#{!PersonalInformationDataBean.pageViewData.contains('registerForPatentss') && !PersonalInformationDataBean.pageViewData.contains('success') && !PersonalInformationDataBean.pageViewData.contains('getReportss') && !PersonalInformationDataBean.pageViewData.contains('searhPatentss') ?'display:none':'display:inherit'};">
<a href="" class="level1 parent">
<span>
<span class="icon" style="background-image: url('images/menu/icon_menu_features.png');background-repeat: no-repeat; background-position: top center">
</span>Projects/Inventions
</span>
</a>
<div class="dropdown columns1">
<div class="dropdown-bg" style="overflow: hidden; width: 239px; height: 202px; ">
<div>
<div class="width100 column">
<ul class="level2">
<li class="level2 item200" style="width: 210px;#{PersonalInformationDataBean.pageViewData.contains('registerForPatentss')?'display:inherit':'display:none'}">
<a href="registerForPatentss.xhtml" class="level2">
<span>Register New Applicant
</span>
</a>
</li>
<li class="level2 item201" style="width: 210px;#{PersonalInformationDataBean.pageViewData.contains('success')?'display:inherit':'display:none'}">
<a href="success.xhtml" class="level2">
<span>Register New Project
</span>
</a>
</li>
<li class="level2 item202" style="width: 210px;#{PersonalInformationDataBean.pageViewData.contains('getReportss')?'display:inherit':'display:none'}">
<a href="getReportss.xhtml" class="level2">
<span>Project Reports
</span>
</a>
</li>
<li class="level2 item203" style="width: 210px;#{PersonalInformationDataBean.pageViewData.contains('searhPatentss')?'display:inherit':'display:none'}">
<a href="searhPatentss.xhtml" class="level2">
<span>Search For Project
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</li>
<li class="level1 item102 parent makeSpace default" style="#{!PersonalInformationDataBean.pageViewData.contains('systemLog') && !PersonalInformationDataBean.pageViewData.contains('addUser') && !PersonalInformationDataBean.pageViewData.contains('changePass') && !PersonalInformationDataBean.pageViewData.contains('userlistss')?'display:none':'display:inherit'}">
<a href="" class="level1 parent">
<span>
<span class="icon" style="background-image: url('images/menu/icon_menu_features.png');background-repeat: no-repeat; background-position: top center">
</span>Administrative
</span>
</a>
<div class="dropdown columns1">
<div class="dropdown-bg" style="overflow: hidden; width: 209px; height: 202px; ">
<div>
<div class="width100 column">
<ul class="level2">
<li class="level2 item200" style="width: 180px;#{PersonalInformationDataBean.pageViewData.contains('addUserss')?'display:inherit':'display:none'}">
<a href="addUserss.xhtml" class="level2">
<span>Add User Account
</span>
</a>
</li>
<li class="level2 item201" style="width: 180px;#{PersonalInformationDataBean.pageViewData.contains('logPatentSystemss')?'display:inherit':'display:none'}">
<a href="logPatentSystemss.xhtml" class="level2">
<span>System Log
</span>
</a>
</li>
<li class="level2 item202" style="width: 180px;#{PersonalInformationDataBean.pageViewData.contains('changePass')?'display:inherit':'display:none'}">
<a href="changePass.xhtml" class="level2">
<span>Change Password
</span>
</a>
</li>
<li class="level2 item203" style="width: 180px;#{PersonalInformationDataBean.pageViewData.contains('userlistss')?'display:inherit':'display:none'}">
<a href="userlistss.xhtml" class="level2">
<span>Details Of Registered Users
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</li>
</ul>
</nav>
</div>
</span>
</div>
This gives me output as below (its not same, but somewhat like this).
Home | Projects | Administrative
| |
| |
|- Men 1 |- Ad 1
|- Men 2 |- Ad 2
|- Men 3 |- Ad 3
Now what I want to do is
When Men 1 is selected, <li class="level1 item102 parent makeSpace default" should change to <li class="level1 item102 parent makeSpace active" i.e. take out default and take in active class.
When I click on Ad 2, <li class="level1 item102 parent makeSpace default" should change to <li class="level1 item102 parent makeSpace active"
Any idea how to get this done? I check online, however examples I get was for Level 0 menu.
See The demo
jQuery:
$("#menubar").on("click","li",function(e){
e.preventDefault();
e.stopPropagation();
if($(this).hasClass("active"))
{
$(this).removeClass("active").addClass("default");
}
else
{
$(this).addClass("active").removeClass("default");
}
});
What I did is is below....
var myURL = window.location.toString();
var endIndex = myURL.lastIndexOf(".", myURL);
var startIndex = myURL.lastIndexOf("/")+1;
var pageAccessed = myURL.substr(startIndex, endIndex-startIndex);
if (pageAccessed=="successLoginss") {
$(".homemenu").addClass("active");
$(".homemenu").removeClass("default");
}
<li class="level1 item101 default homemenu">
<a href="index.xhtml" class="level1">
<span>
<span class="icon" style="background-image: url('images/menu/icon_menu_home.png');background-repeat: no-repeat; background-position: top center">
</span>
Home
</span>
</a>
</li>
Dats it..... I know this is not right way, but I had to get done this way....