Vertical side nav bar - Angular 4 and Bootstrap 3
25,279
First You need to Import bootstrap 3 or Use Bootstrap 3 CDN
Then Instead of using JQuery Use Directive to manipulate Class and Style of Side Bar
I Have Created Stack blitz for same side Bar without using JQuery Check this: https://stackblitz.com/edit/angular-z6hrob
Author by
VicentVega
Updated on August 07, 2020Comments
-
VicentVega almost 4 years
I have installed bootstrap 3 in my angular 4 project using the npm installer. I have a basic site done up and am trying to get an dynamic sideNav bar that will toggle in and out.
I have seen some examples online however they do not seem to work whether it be a newer version of bootstrap or compatibility issues with angular.
Does anyone have any recommendations for a navigation bar that I could use in this instance?
The HTML in my
app.component.html
:<!-- Sidebar --> <script src="src/Javascript/sidebar.js"></script> <nav class="navbar navbar-inverse navbar-fixed-left" id="sidebar-wrapper" role="navigation"> <ul class="nav sidebar-nav"> <li class="sidebar-brand"> <a href="#"> Brand </a> </li> <li> <a href="#">Home</a> </li> <li> <a href="#">About</a> </li> <li> <a href="#">Events</a> </li> <li> <a href="#">Team</a> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Works <span class="caret"></span> </a> <ul class="dropdown-menu" role="menu"> <li><a href="#">About</a></li> <li><a href="#">Services</a></li> <li><a href="#">Clients</a></li> <li><a href="#">Contact</a></li> </ul> </li> <li> <a href="#">Services</a> </li> <li> <a href="#">Contact</a> </li> </ul> </nav>
-
Deepak Verma almost 6 yearsare u using any npm module for it?
-
Chellappan வ almost 6 yearsi am not using any npm module for this. only bootstrap
-
Deepak Verma almost 6 yearshmm what is this sidebar.directive.ts you have imported this in your app module file
-
Chellappan வ almost 6 yearsthat is angular directive which is used toggle bootstrap class when you click the icon
-
Deepak Verma almost 6 yearsif you dont mind could you please come to chat room?
-
netalex over 4 yearsplease do not use jquery in your angular components
-
Chellappan வ over 4 yearsI have not used JQuery
-
Rick O'Shea over 4 years... and only 300 lines of cut-and-paste custom CSS. Anything this prolific should be a drop-in component with a few styles and a simple list of menu items and action callbacks.