Passing HTML into my component - html

Consider the following component sidebar.component.html:
<div class="sidebar">
<ul>
<li class="tooltipped" data-position="right" data-delay="50" data-tooltip="Go to the dashboard">
<a href="#">
<i class="material-icons">home</i>
<span>Home</span>
</a>
</li>
<li class="tooltipped" data-position="right" data-delay="50" data-tooltip="Manage your times">
<a href="#">
<i class="material-icons">watch_later</i>
<span>Times</span>
</a>
</li>
<li class="tooltipped" data-position="right" data-delay="50" data-tooltip="Go to settings">
<a href="#">
<i class="material-icons">settings</i>
</a>
</li>
</ul>
</div>
In app.component.html, I use the sidebar using its tags (<sidebar>). However, now I want to make it so that the <li> elements are given inside the <sidebar> tags so that they are no longer inside sidebar.component.html to make the component re-usable.
I'm not sure what this is called and I am having trouble finding it.
Thanks in advance.

Create a sidebar component with an <ng-content> where the passed children should be displayed
#Component({
selector: 'sidebar',
template: '<ul><ng-content></ng-content></ul>'
})
export class SidebarComponent {
}
and use it like
<sidebar>
<li class="tooltipped" data-position="right" data-delay="50" data-tooltip="Go to the dashboard">
<a href="#">
<i class="material-icons">home</i>
<span>Home</span>
</a>
</li>
<li class="tooltipped" data-position="right" data-delay="50" data-tooltip="Manage your times">
<a href="#">
<i class="material-icons">watch_later</i>
<span>Times</span>
</a>
</li>
<li class="tooltipped" data-position="right" data-delay="50" data-tooltip="Go to settings">
<a href="#">
<i class="material-icons">settings</i>
</a>
</li>
</sidebar>

Related

Avoid fixed height issue related to Bootstrap Navbar. (Mega Menu)

I am trying to avoid fixed height of bootstrap columns. I do have a Custom Mega Menu in my project where we show all our Nav bar entries. This one is a dynamically created code so it will be difficult to change the logic of the Mega menu creation so I am looking for some Css solution to fix this issue.
My code in high level look like.
<div class="row">
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
<div class="col-xl-3">... contents </div>
</div>
Since this one is a dynamic item we can expect n number of col-xl-3
The issue is I am getting some extra space in between columns. ( taking the max size item's size in each row)
As you can see in the image attached, The yellow color marked area I am trying to avoid.
I have tried to use d-block with float-left to the child elements.
Then I am getting display something like below.
Here also I am getting extra space in some places. Is there any way to get out of this issues?
What I am looking for is to move sections 5 to below 1 st section and 6 one to below 2 nd section etc .And remove the extra space between top and bottom columns
(the yellow highlighted space in the image)
I am adding a testing sample below here.
<html lang="en">
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"
type="text/css">
</head>
<div class="container-outer">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12 col-12 navtop">
<nav class="navbar navbar-expand-lg navbar-light">
<div id="navbarContent" class="collapse navbar-collapse flex-md-column">
<ul class="navbar-nav mr-auto second-ul">
<ul class="navbar-nav treemenu">
<li class="nav-item dropdown position-static">
<a class="nav-link mnn-nav-link channelclass" href="#" id="navbarDropdown"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
MENU
<i class="fa fa-down"></i>
</a>
<div class="dropdown-menu w-100 ddn" aria-labelledby="navbarDropdown">
<div class="row d-block">
<div class="col-xl-3 float-left">
<p data-id="ACCT" class="submenu-title mnn-sdaaaent-nav-click">
1
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled ACCT ">
<li>
<a class="mnn-nav-sub-click" data-id="IPASSBOOKACCT">
seffwew
<i class="fa fa-down"></i>
</a>
<ul class="list-unstyled seffwewACCT mnn-nav-ul-sub" style="display: none;">
<li>
General Information
</li>
<li>
sefscsdsd Summary
</li>
<li>
Transaction
</li>
</ul>
</li>
<li>
sfdsfsds Income
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<p data-id="TAX" class="submenu-title mnn-sdaaaent-nav-click">
2
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled TAX ">
<li>
2019 sdfdsfsfsdfs Forms
<sup class="newtext">NEW</sup>
</li>
<li>
<a target="_blank" href="/Commonfiles/2019/2019POFManual.pdf">2019 POF Manual</a>
<sup class="newtext">NEW</sup>
</li>
<li>
Estimated Composite sdfdsfsfsdfses 4th Qtr Election
</li>
<li>
ds sfsdsdsd and Consent
</li>
<li>
NY IT-2658 Estimate
</li>
<li>
State sdfdsfsfsdfs Questionnaire
</li>
<li>
sdfdsfsfsdfs Presdaaaation Sign-Up
</li>
<li>
<a class="mnn-nav-sub-click" data-id="ARCHIVES">
Archives
<i class="fa fa-down"></i>
</a>
<ul class="list-unstyled ARCHIVES mnn-nav-ul-sub" style="display: none;">
<li>
2018 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2018/2018POFManual.pdf">2018 POF Manual</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2018/2018SampleForms965and965-A.PDF">2018 dfgdfgdg Manual addendum-Sample Forms 965 and 965-A</a>
</li>
<li>
Section 965 State by State Instructions
</li>
<li>
2017 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2017/Sec965FAQ.pdf">Section 965 FAQs</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2017/2017dfgdfgdgManual.pdf">2017 dfgdfgdg Manual</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2017/2017sdfdsfsfsdfs_Information.pdf">2017 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2017/2017dfgdfgdgManualAddendum965TransitionsdfdsfsfsdfsREVISED101218.pdf">2017 dfgdfgdg Manual Addendum 965 Transition sdfdsfsfsdfs revised 101218</a>
</li>
<li>
2016 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2016/2016_sdfdsfsfsdfsInformation.pdf">2016 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2016/2016dfgdfgdgManual.pdf">2016 dfgdfgdg Manual</a>
</li>
<li>
2015 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2015/2015sdfdsfsfsdfsInformation.pdf">2015 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2015/2015dfgdfgdgManual.pdf">2015 dfgdfgdg Manual</a>
</li>
<li>
2014 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/Commonfiles/2014/2014sdfdsfsfsdfsInformation.pdf">2014 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2014/2014dfgdfgdgManual.pdf">2014 dfgdfgdg Manual</a>
</li>
<li>
2013 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/CommonFiles/2013/2013sdfdsfsfsdfsInformation.pdf">2013 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2013/2013dfgdfgdgManual.pdf">2013 dfgdfgdg Manual</a>
</li>
<li>
2012 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/CommonFiles/2012/2012sdfdsfsfsdfsInformation.pdf">2012 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2012/2012dfgdfgdgManual.pdf">2012 dfgdfgdg Manual</a>
</li>
<li>
2011 sdfdsfsfsdfs Forms
</li>
<li>
<a target="_blank" href="/CommonFiles/2011/2011sdfdsfsfsdfsInformation.pdf">2011 sdfdsfsfsdfs Information</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/2011/2011dfgdfgdgManual.pdf">2011 dfgdfgdg Manual</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<p data-id="FINPLANPTR" class="submenu-title mnn-sdaaaent-nav-click">
3
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled FINPLANPTR ">
<li>
dfgdfgdg-dfgdgdfgdfg Planning Services sfsdsdsd
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<p data-id="ADM" class="submenu-title mnn-sdaaaent-nav-click">
4
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled ADM ">
<li>
<a target="_blank" href="/Commonfiles/dfdfs/DirectAdmitBook.pdf">Direct dfdfs Manual</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/dfdfs/NewsdsdsdManual.pdf">New sdsdsd & Principal Manual</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/dfdfs/sdsdsdshipagreements.pdf">sdsdsdship Agreements</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/dfdfs/Americas_Operating_Agreement_as_amended_July_4_2015.pdf">Americas Operating Agreement</a>
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<p data-id="RET" class="submenu-title mnn-sdaaaent-nav-click">
5
<i class="sub-up-down fa-up fa"></i>
</p>
<ul class="list-unstyled RET ">
<li>
<a class="mnn-nav-sub-click" data-id="SPDS">
Summary Plan Descriptions (sdssdsd)
<i class="fa fa-down"></i>
</a>
<ul class="list-unstyled sdssdsd mnn-nav-ul-sub" style="display: none;">
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU sdsdsdship sdsdaa Plan - HR-10 Plan - 2016.pdf">TYU sdsdsdship sdsdaa Plan -HR10-Plan</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU sdsdaa Savings Plan -401(k) sdsdsd-principles - 2016.pdf">TYU sdsdaa Savings Plan-401(k)</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU PDBRP and IDBRP 2017.pdf">TYU PDBRP and IDBRP</a>
</li>
</ul>
</li>
<li>
<a href="/sdsdaa/401kContribution/_401kExclusionMsg">
401(k) asdaaa and
Election
</a>
</li>
<li>
<a class="mnn-nav-sub-click" data-id="sdssdsd">
Summary Plan Descriptions (sdssdsd)
<i class="fa fa-down"></i>
</a>
<ul class="list-unstyled sdssdsd mnn-nav-ul-sub" style="display: none;">
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU sdsdsdship sdsdaa Plan - HR-10 Plan - 2016.pdf">TYU sdsdsdship sdsdaa Plan -HR10-Plan</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU sdsdaa Savings Plan -401(k) sdsdsd-principles - 2016.pdf">TYU sdsdaa Savings Plan-401(k)</a>
</li>
<li>
<a target="_blank" href="/Commonfiles/sdsdaa/TYU PDBRP and IDBRP 2017.pdf">TYU asdadad and sdfsfsdsd</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="col-xl-3 float-left">
<a target="_blank" class="submenu-title mnn-sdaaaent-nav-click" href="https://sdaaa.TYU.net">6</a>
</div>
<div class="col-xl-3 float-left">
<a class="submenu-title mnn-sdaaaent-nav-click" href="https://ptrshpdashboard.TYU.net">7</a>
</div>
</div>
</div>
</li>
</ul>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
$("#navbarContent").hide();
$('.navtrigger').click(function () {
$("#navbarContent").toggle();
$(this).toggleClass('active');
$("#mainListDiv").toggleClass("show_list");
$("#mainListDiv").fadeIn();
});
setTimeout(function () {
$('body').addClass('loaded');
}, 100);
});
$(".mnn-nav-ul-sub").hide();
$(".mnn-nav-sub-click").click(function () {
$(".mnn-nav-ul-sub").slideToggle();
$(this).find('i').toggleClass('fa fa-down fa fa-up');
$(".mnn-nav-sub-click").sdaaaent().removeClass('navactive');
});
$(".ddn").on("click", function (e) {
e.stopPropagation();
});
</script>
</body>
</html>
maybe this helps you CSS: remove empty Space between boxes
In your case
.wrapper {
column-count: 3;
column-gap: 1.25rem;
}
.part {
break-inside: avoid-column;
position: relative;
display: inline-block;
width: 100%;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
}
.row will be .wrapper and .col-xl-3 is .part, I recommend you not to use bootstrap classes for this

How to keep the selected accordion active on page reload

I am using materialize collapsible for my navigation. Everything works fine except when I reload the page. The collapsible gets closed and I have to manually make it active again. How do I make the collapsible remain active on page reload?
Here's my code:
<ul id="slide-out" class="side-nav fixed leftside-navigation">
<ul class="collapsible" data-collapsible="expandable">
<li>
<a class="collapsible-header">
<i class="material-icons">home</i> Home
</a>
<div class="collapsible-body">
<ul>
<li ui-sref-active="active">
<a ui-sref="protect" ui-sref-opts="{reload: true}">
<i class="material-icons">dashboard</i> Dashboard
</a>
</li>
<li ui-sref-active="active">
<a ui-sref="store" ui-sref-opts="{reload: true}">
<i class="material-icons">cloud_done</i> Storage
</a>
</li>
</ul>
</div>
</li>
<li>
<a class="collapsible-header">
<i class="material-icons">event_available</i>Manage
</a>
<div class="collapsible-body">
<ul>
<li ui-sref-active="active">
<a ui-sref="manage" ui-sref-opts="{reload: true}">
<i class="material-icons">storage</i> Manage Storage
</a>
</li>
<li ui-sref-active="active">
<a ui-sref="enroll" ui-sref-opts="{reload: true}">
<i class="material-icons">file_download</i> Enroll
</a>
</li>
</ul>
</div>
</li>
</ul>
</ul>
What you want to do concerns program state, hence there's no way for you to do that unless you save the name or id of the active accordion. which can easily be done using browser local storage.

How to hide first level span element by CSS ">" selector

Here is my HTML code
.wrapper.mini-menu .sidebar-nav li > span{
display: none;
}
<div class="wrapper mini-menu">
<div class="header"></div>
<div class="sidebar">
<ul class="sidebar-nav">
<li>
<a href="#">
<i class="fa fa-home"></i>
<span>Hide Item1</span>
<i class="fa arrow pull-right"></i>
</a>
<ul class="sub-menu">
<li>
<a href="">
<i class="fa fa-user-plus"></i>
<span>Show Item 1</span>
</a>
</li>
<li>
<a href="">
<i class="fa fa-user-plus"></i>
<span>Show Item 2</span>
</a>
</li>
</ul>
</li>
<li>
<a href="#item1">
<i class="fa fa-dashboard"></i>
<span>Hide Item2</span>
</a>
</li>
<li>
<a href="#item1">
<i class="fa fa-cogs"></i>
<span>Hide Item3</span>
</a>
</li>
</ul>
</div>
</div>
I want to hide hide item1, hide item2 and hide item3. But I don't want to hide show items. If I don't use > selector it hides all span elements. How to select only those item by CSS > selector?
What your current CSS selector is saying is:
Hide all spans that are children of li that are descendants of .sidebar-nav. If you only want to target first level li elements do this instead:
.wrapper.mini-menu .sidebar-nav > li > a > span {
display: none;
}
Look:
.wrapper.mini-menu .sidebar-nav > li > a{
display: none;
}
<div class="wrapper mini-menu">
<div class="header"></div>
<div class="sidebar">
<ul class="sidebar-nav">
<li>
<a href="#">
<i class="fa fa-home"></i>
<span>Hide Item1</span>
<i class="fa arrow pull-right"></i>
</a>
<ul class="sub-menu">
<li>
<a href="">
<i class="fa fa-user-plus"></i>
<span>Show Item 1</span>
</a>
</li>
<li>
<a href="">
<i class="fa fa-user-plus"></i>
<span>Show Item 2</span>
</a>
</li>
</ul>
</li>
<li>
<a href="#item1">
<i class="fa fa-dashboard"></i>
<span>Hide Item2</span>
</a>
</li>
<li>
<a href="#item1">
<i class="fa fa-cogs"></i>
<span>Hide Item3</span>
</a>
</li>
</ul>
</div>
You select a span standing right after the .fa-user-plus icon with the + selector , but not so sure this what you look for ?
#import url("//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css");
span {
display:none;
}
.fa.fa-user-plus + span{
display: inline-block;
}
<div class="wrapper mini-menu">
<div class="header"></div>
<div class="sidebar">
<ul class="sidebar-nav">
<li>
<a href="#">
<i class="fa fa-home"></i>
<span>Hide Item1</span>
<i class="fa arrow pull-right"></i>
</a>
<ul class="sub-menu">
<li>
<a href="">
<i class="fa fa-user-plus"></i>
<span>Show Item 1</span>
</a>
</li>
<li>
<a href="">
<i class="fa fa-user-plus"></i>
<span>Show Item 2</span>
</a>
</li>
</ul>
</li>
<li>
<a href="#item1">
<i class="fa fa-dashboard"></i>
<span>Hide Item2</span>
</a>
</li>
<li>
<a href="#item1">
<i class="fa fa-cogs"></i>
<span>Hide Item3</span>
</a>
</li>
</ul>
</div>
</div>

Placing a DIV in my header

I'm trying to put a linkable image into my header RIGHT underneath the phone number but its not working. My question is where do I place the div and how do I style it?
The code for me current header is:
<div class="header-right">
<div class="social">
<!--social media icons-->
<ul>
<li>
<a class="contact" href="http://" title="Contact Us"></a>
</li>
<li>
<a class="google" href="http:/" target="_blank" title="Share on Google+"></a>
</li>
<li>
<a class="facebook" href="http:/" target="_blank" title="Share on Facebook"></a>
</li>
<li>
<a class="twitter" href="http:/" target="_blank" title="Share on Twitter"></a>
</li>
</ul>
</div>
<div class="telephone">
<p class="tel">Speak with<br/>
<?php bloginfo( 'description' ); ?><br />
<small>Available 08:30 - 17:00, Mon-Fri</small>
</p>
</div>
</div>
<div class="header-right">
<div class="social">
<!--social media icons-->
<ul>
<li>
<a class="contact" href="http://" title="Contact Us"></a>
</li>
<li>
<a class="google" href="http:/" target="_blank" title="Share on Google+"></a>
</li>
<li>
<a class="facebook" href="http:/" target="_blank" title="Share on Facebook"></a>
</li>
<li>
<a class="twitter" href="http:/" target="_blank" title="Share on Twitter"></a>
</li>
</ul>
</div>
<div class="telephone">
<p class="tel">Speak with<br/>
info<br />
<div>an image</div>
<small>Available 08:30 - 17:00, Mon-Fri</small>
</p>
</div>
</div>

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);
}
})