I have to customize sidebar that is provided by COREUI 4.x theme. Below is the code for my sidebar
<div class="app-body">
<div class="sidebar">
<nav class="sidebar-nav">
<ul class="nav">
<li class="nav-item">
<a
class="nav-link"
routerLink="/dashboard"
[routerLinkActive]="['active']"
[routerLinkActiveOptions]="{ exact: true }"
>
<i class="icon-speedometer"></i> Dashboard
</a>
</li>
<li class="nav-item">
<a
class="nav-link"
href="#"
routerLink="/alerts-configuration"
[routerLinkActive]="['active']"
[routerLinkActiveOptions]="{ exact: true }"
>
<i class="icon-layers"></i> Alert Configuration
</a>
</li>
<li
class="nav-item nav-dropdown"
dropdown
[routerLinkActive]="['active']"
[routerLinkActiveOptions]="{ exact: true }"
>
<a class="nav-link nav-dropdown-toggle">
<i class="icon-puzzle"></i>Administration
</a>
<ul class="nav-dropdown-items">
<li class="nav-item">
<a
class="nav-link"
routerLink="/device-management/devices"
[routerLinkActive]="['active']"
[routerLinkActiveOptions]="{ exact: true }"
>
<i class=""></i>Devices Management
</a>
</li>
<li class="nav-item">
<a
class="nav-link"
routerLink="/sites"
[routerLinkActive]="['active']"
[routerLinkActiveOptions]="{ exact: true }"
>
<i class="icon-settings"></i>Sites Management
</a>
</li>
</ul>
</li>
</ul>
</nav>
<button class="sidebar-minimizer brand-minimizer" type="button"></button>
</div>
</div>
Now when I try to click on Administration, it wont open the dropdown and also when I try to minimize from the arrow on the bottom, this wont work as well. Please help!
I was having this issue also. I figured out that if the JavaScript files that control sidebar animation are added before the page is generated the sidebar doesn't work.
The solution:
Add the CORE UI JavaScript files at the end.
Looks a little like this:
<html>
<body>
{the entire html page}
<script src="https://coreui.io/demo/free/3.4.0/js/main.js" async defer></script>
</body>
</html>
"async defer" may or may not be necessary.
With coreui 4.x and BS 5 you should add data-coreui="navigation" to the sidebar-nav element and it will start working correctly.
Please find below my code that is working.
<li class="nav-item nav-dropdown " [appIsAuthorized]="roleconst.ProductAdminAbove" (click)="status=!status"
[ngClass]="status ? 'open' : ''">
<a class="nav-link nav-dropdown-toggle ">
<i class="nav-icon icon-puzzle"></i> Management
</a>
Related
So I am a beginner in angular and I have to simply make a navbar.I have my bootstrap loaded in the .json file and it looks like this:-
"styles": [
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
whereas my code looks like this:-
<ul class=" nav navbar-nav navbar-right">
<ul class="dropdown-menu">
<li >
<a class="nav-link" href="#">Save Data</a>
</li>
<li >
<a class="nav-link" href="#">Fetch Data</a>
</li>
</ul>
</ul>
</div>
</div>
</nav>
`
Output is :-
my save data and fetch data are not appearing on right.what is the reason?
Just replace "navbar-right" with "ml-auto".
But still things are wrong with your code apart from "navbar-right".
It should be -
<ul class="navbar-nav ml-auto">
<li >
<a class="nav-link" href="#">Save Data</a>
</li>
<li >
<a class="nav-link" href="#">Fetch Data</a>
</li>
</ul>
I am familiar with the tutorial you are working with, so I guess you are creating a dropdown menu, this should be the complete code for it-
<ul class = "navbar-nav ml-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown">
Manage
</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Save Data</a>
<a class="dropdown-item" href="#">Fetch Data</a>
</div>
</li>
</ul>
These existing questions might help -
Bootstrap NavBar with left, center or right aligned items
ml-auto is not pushing navbar links to the right
I'm working on a page in a Node Web app with a subnav that looks like this:
Here's the vanilla HTML for it:
<div class="col-md-8">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" href="#">Overview</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
</li>
</ul>
</div>
Is there a way for me to create live links (e.g. Comments) on those tabs without having to render a whole separate route and EJS template? To me, a process like that would be more efficient and DRY than creating separate templates for each link in the subnav.
Any help would be greatly appreciated. Thanks!
I have a navbar component with this code:
<ul class="navbar-nav mx-auto">
<li class="nav-item active">
<a class="nav-link" href="#" >Inicio <span class="sr-only"></span></a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#">Here Link Home Section 2 <span class="sr-only"></span></a>
</li>
</ul>
and have another component HomeComponent with 3 sections:
<section id="home_one">
stuff
section
one
</section>
<section id="home_two">
stuff
section
two
</section>
<section id="home_three">
stuff
section
three
</section>
How can I link from navbar links to specific section (section 2) in another component (homeComponent)?
Angular 6.1 has new featured called anchorScrolling, Enable this option and use Router fragement
app.module.ts
#NgModule({
imports: [BrowserModule, FormsModule, RouterModule.forRoot(routes, {
anchorScrolling: 'enabled',
})],
declarations: [AppComponent, HelloComponent, ComponentbComponent],
bootstrap: [AppComponent]
})
app.component.html
<a [routerLink]="['item']" [fragment]="'section2'">
section2
</a>
<router-outlet></router-outlet>
Example:https://stackblitz.com/edit/angular-zgmsuw
In an angular way Its better for you to use Angular Router
Create Three components Instead of Sections
home_one
home_two
home_three
Then In your App Module Or in Seperate Routing Module declare you routes like:
const routes: Routes = [
{ path: 'home_one', component: home_one},
{ path: 'home_two', component: home_two },
{ path: 'home_three', component: home_three }
{ path: '', component: home }
{ path: '*', component: home }
];
Then In your Imports add routes
#NgModule({
imports: [RouterModule.forRoot(routes)],
})
Then In you 'Home page' or where ever you want to Render these sections Add Router Outlet, It will be something like this
<your-navbar-component></your-navbar-component>
<router-outlet></router-outlet>
In Your navbar configure your Anchor for your routes properly
<ul class="navbar-nav mx-auto">
<li class="nav-item " routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
<a class="nav-link" [routerLink]="['/home_one']" >Home One <span class="sr-only"></span></a>
</li>
<li class="nav-item " routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
<a class="nav-link" [routerLink]="['/home_two']" >Home Two<span class="sr-only"></span></a>
</li>
<li class="nav-item " routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
<a class="nav-link" [routerLink]="['/home_three']" >Home Three<span class="sr-only"></span></a>
</li>
</ul>
For more Visit Official documentation:
https://angular.io/guide/router
If this is onclick of tabs and changing of corresponding section of tabs:-
.ts
tab = 'tab0';
.html
<ul class="navbar-nav mx-auto">
<li class="nav-item active" (click)='tab = "tab0"'>
<a class="nav-link" href="#" >Inicio <span class="sr-only"></span></a>
</li>
<li class="nav-item active" (click)='tab = "tab1"'>
<a class="nav-link" href="#">Here Link Home Section 2 <span class="sr-only"></span></a>
</li>
</ul>
<section id="home_one" *ngIf="tab ==='tab0'">
stuff
section
one
// Here you can pass selctor of a separate component for each section
// <tab0-component></tab0-component>
</section>
<section id="home_two" *ngIf="tab ==='tab1'">
stuff
section
two
</section>
<section id="home_three" *ngIf="tab ==='tab2'">
stuff
section
three
</section>
If you want to go to corresponding fragment onclick ie to scrollview in that document:-
Angular2 Routing with Hashtag to page anchor
If you want to change routes for each tab then:-
app.routing.ts
// create routes for each tab
.ts
constructor(public router:Router){
}
opentab(routes){
this.router.navigate[routes]
}
.html
<ul class="navbar-nav mx-auto">
<li class="nav-item active" (click)= 'opentab("tab0")'>
<a class="nav-link" href="#" >Inicio <span class="sr-only"></span></a>
</li>
<li class="nav-item active" (click)= 'opentab("tab1")'>
<a class="nav-link" href="#">Here Link Home Section 2 <span class="sr-only"></span></a>
</li>
</ul>
<router-outlet></router-outlet>
I m trying to open sidebar option in right side using bootstrap4 Vue but it's not working
here is my HTML
<li class="nav-item nav-dropdown open" disabled="disabled">
<div class="nav-link nav-dropdown-toggle">
<i class="fa fa-cart-arrow-down"></i>Product
</div>
<ul class="nav-dropdown-items">
<li class="nav-item">
<div>
<a href="#/product/Addproduct" class="nav-link">
<i class="fa fa-circle-thin"></i>Addproduct</a>
</div>
</li>
<li class="nav-item">
<div>
<a href="#/product/Listproduct" class="nav-link">
<i class="fa fa-circle-thin"></i>Listproduct</a>
</div>
</li>
</ul>
</li>
i want Addproduct & listProduct in right side instead of down
I tried to use dropdown right but it stops working any ideas what i m doing wrong.
I don't know what version are you using but just check the docs for pull-right and replace your default classes with the classes for right side.
As I write in the title, I tried to pass from Bootstrap 3 to 4 and after my update, my navbar was broken :
I did nothing wrong and i really can't understand why the inline-block is not working anymore. I tried every thing I found on stackOverflow about this subject and nothing happenned..
Here is my HTML code :
<nav class="navbar navbar-inverse" role="navigation">
<div class="center-block text-center">
<button class="collapse-btn" (click)="toggleMenu()">
<i *ngIf="!isCollapsed()" class="fa fa-chevron-up" aria-hidden="true"></i>
<i *ngIf="isCollapsed()" class="fa fa-chevron-down" aria-hidden="true"></i>
</button>
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" routerLink="/home">Progression</a></li>
<li class="nav-item"><a class="nav-link" href="#">Activité pédagogique</a></li>
<li class="nav-item"><a class="nav-link" href="#">Evalutation</a></li>
<li class="nav-item"><a class="nav-link" href="#">Synthèse</a></li>
<li class="nav-item"><a class="nav-link" href="#">Certification</a></li>
</ul>
</div>
</nav>
Thanks for your help.
I found it, it seems that i needed to change property display for navbar-nav from inline-block to flex.
.navbar-nav {
display: flex;
}