problem with angular navigation bar

Currently, I am working on a project using angular and encountering an issue with the navigation bar.

I have attached two screenshots for reference. The first screenshot displays the layout before logging in, and the second one showcases the layout after logging in as the administrator. In the first screenshot, I would like the alignment of "Sign Up" and "Login" to be inline with the left side and in the same row.

In the second screenshot, I want the "Admin Panel" option to also be on the same row as mentioned above.

Screenshot 1: https://i.sstatic.net/FD04D.png

Screenshot 2: https://i.sstatic.net/jc23k.png

Below is the code snippet:

<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">Auction App</a>
    </div>
    <ul class="nav navbar-nav">
      <li class="active"><a routerLink='/home'>Home</a></li>
      
      <li ><a routerLink='/myAuctions'>MyAuctions</a></li>
      <li><a href="#">MyOffers</a></li>
      <li><a href="#">Messages</a></li>
      <div *ngIf="checkIfAdminisLoggedIn() === true;">
        <li><a routerLink='/board-admin'><span class="glyphicon glyphicon-user"></span> Admin Panel</a></li>
      </div>
    </ul>
    <ul class="nav navbar-nav navbar-right">
      <div *ngIf="isLoggedIn === false; else elseBlock">
        <li><a routerLink='/register' href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
        <li><a routerLink='/login'> <span class="glyphicon glyphicon-log-in"></span>Login</a></li>
      </div>
      <ng-template #elseBlock>
        <li><a (click)="onLogout()"><span class="glyphicon glyphicon-log-in"></span> Logout</a></li>
      </ng-template>
    </ul>
  </div>
</nav>

CSS Styles:

.ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
  }

Answer №1

Your Admin panel is currently located on the left side of your navbar. To ensure it functions correctly, consider moving it to the right as shown below:

    <nav class="navbar navbar-inverse">
      <div class="container-fluid">
        <div class="navbar-header">
          <a class="navbar-brand" href="#">Auction App</a>
        </div>
        <ul class="nav navbar-nav">
          <li class="active"><a routerLink='/home'>Home</a></li>
          
          <li ><a routerLink='/myAuctions'>MyAuctions</a></li>
          <li><a href="#">MyOffers</a></li>
          <li><a href="#">Messages</a></li>
          
        </ul>
        <ul class="nav navbar-nav navbar-right">
          <div *ngIf="isLoggedIn === false; else elseBlock">
            <li><a routerLink='/register' href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
            <li><a routerLink='/login'> <span class="glyphicon glyphicon-log-in"></span>Login</a></li>
          </div>
<div *ngIf="checkIfAdminisLoggedIn() === true;">
            <li><a routerLink='/board-admin'><span class="glyphicon glyphicon-user"></span> Admin Panel</a></li>
          </div>
          <ng-template #elseBlock>
            <li><a (click)="onLogout()"><span class="glyphicon glyphicon-log-in"></span> Logout</a></li>
          </ng-template>
        </ul>
      </div>
    </nav>

To remove the blue and purple colors when links are visited, apply the following CSS:

a, a:hover, a:focus, a:active {
    text-decoration: none;
    color: inherit;
}

Modify the CSS as needed to suit your preferences.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Steps to resolve transition zoom issues with images

I'm having trouble showcasing blog posts with an image. Currently, I am utilizing card-columns from Bootstrap 4, and when the user hovers over the image, it scales up. The issue arises when the transition occurs, as my border radius resets to defaul ...

I'm attempting to set up three columns that fade in responsively. Is there a way to make them appear side by side instead of stacking on top of each other?

Is there a way to display the three columns horizontally instead of vertically? I also want them to adjust responsively and fade smoothly. Here is my fiddle link: https://jsfiddle.net/Spleendrivel/dswufb78/3/ <!DOCTYPE html> <html> <head ...

Tips for personalizing tooltips in Bootstrap 4

Currently, I am utilizing Bootstrap '4.0.0-alpha.6' and attempting to customize the tooltip styles. Despite adding a custom CSS class along with using Bootstrap 4, the tooltip is not responding correctly to my specified style when hovering over. ...

Is the communication between Angular service and component failing when using ngFor?

I am currently using Angular to create a video game page. When a specific title is clicked, the id is sent to make an API call with that specific id. I am able to retrieve the data in the selected-games component where I intend to use it, but when I use ng ...

The Angular application is currently building successfully, however when launched it displays a blank white screen. Upon checking the network tab

Seeking assistance as I am encountering a blank screen in the browser after debugging my Angular 15 application. The workspace does not exhibit any issues or errors. However, upon exploring the Network tab in DevTools, I observed that config.js, styles.css ...

The process of Angular Ahead-of-Time (AoT)

After reviewing the latest updates in Angular documentation, it seems that they have made significant changes to their approach. Previously, the process was as follows: Execute the ng eject command to generate webpack.config.js. Create webpack.config.aot ...

The CORS policy has blocked access to XMLHttpRequest at 'https://saja.smjd.ir/api/Account/login' from the specified origin 'http://**'

I have successfully completed my project using Angular 9 on the frontend and asp.net core 3 on the backend, and deployed it to a server. However, I am facing an issue when trying to obtain or use a token from the server. Access to XMLHttpRequest at 'h ...

Angular 10 - Timezone Detection and Interactive Calendar

I am encountering a major issue with the Angular DateTimePicker and TimeZone functionality. I need to dynamically switch the TimeZone at runtime in my component. Every date displayed on the frontend must be converted, while every date sent to the backend n ...

What is the process for modifying the attributes of a currency text box in a Dojo within XPages?

I have come across several discussions aimed at addressing this issue, but none of them have provided a clear and definitive solution that I can easily follow. Is there a straightforward method to modify the css of a dojo field within XPages? Specifically ...

Converting an array with objects to comma separated strings in javascript using (ionic , Angular , NodeJS , MongoDB)

Retrieving specific data from an API array: let passions = [ {_id: "60a1557f0b4f226732c4597c",name: "Netflix"}, {_id: "60a1557f0b4f226732c4597b",name: "Movies"} ] The desired output should be: ['60a1557f0b4f226 ...

Converting Scalable Vector Graphics to Hypertext Markup Language and

So I've got this SVG file called 7.svg. What's the best way to show this image using HTML or CSS on my index.html page? ...

Step-by-step guide on implementing a Searchable Select Drop down in HTML and CSS using just a select element

Is there a way to make this select tag searchable? How can I modify this select tag for searching purposes? <div> <select name="code" id="code"> <option value="">Select Code...</option> ...

Upgrading to SVG icons from font icons - Eliminate inline formatting

After making the decision to transition from font icons to SVG icons, I used Adobe Illustrator to create my SVGs and exported each individual icon using the following settings: Styling: Inline Style Font: SVG Images: Embed Object IDs: Layer Names Decimal ...

I encountered an issue while attempting to retrieve data using route parameters. It seems that I am unable to access the 'imagepath' property as it is undefined

Is there a way to access data when the page loads, even if it is initially undefined? I keep getting this error message: "ERROR TypeError: Cannot read properties of undefined (reading 'imagepath')". How can I resolve this issue? import { Compone ...

Angular: Simplifying complex JSON structures

Is there a built-in feature in Angular for flattening JSON data and then restructuring it back? I came across some code below, but I'm wondering if Angular offers any native library functions for this task. If not, I may consider incorporating this fu ...

Implementing a Radial Cursor with a Custom Background Image in JavaScript

I am attempting to implement a radial cursor on a website that features a background image. Currently, I am facing two main issues: The radial cursor works in Chrome but not in Firefox. When using Firefox, I encounter a parsing error related to the "bac ...

The Material-UI TextField is placed in the Header section of the page

As I scroll down the page, I noticed that the TextField in the header area remains visible. This header is styled using CSS and includes a TextField from the material-ui library. This is my first time creating a header with CSS. Are there any specific cod ...

Steps for eliminating redundant lines in a CSS drop-down navigation bar

When looking at the following CSS code, I noticed that the bottom and top borders seem to overlap, creating a thick line. I'm having trouble figuring out how to remove it. Any suggestions or advice would be greatly appreciated. Thank you! HTML Code: ...

What is the best way to smoothly reveal images one by one?

My goal is to smoothly slide three images inside a div, one by one. However, I'm facing an issue where the images stack on top of each other and end up stuck in their original positions. Here is the code snippet I've been working with: <div ...

Modify the text in a paragraph by clicking on a link using JQuery and HTML

I'm attempting to implement a straightforward action, but I'm facing some challenges. My navigation bar consists of a few links followed by a text section. What I aim for is that when I click on a link, the paragraph of text should change to refl ...