Topic: 'mdb-navbar' is not a known element

Ryannnnn priority asked 7 months ago


Expected behavior that a navbar should be present

Actual behavior Angular app crashes, shows error message

src/app/home/home.component.html:2:5 - error NG8001: 'mdb-navbar' is not a known element:
1. If 'mdb-navbar' is an Angular component, then verify that it is part of this module.
2. If 'mdb-navbar' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

2     <mdb-navbar SideClass="navbar fixed-top navbar-expand-lg navbar-dark scrolling-navbar intro-fixed-nav" [containerInside]="false">
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  src/app/home/home.component.ts:6:18
    6     templateUrl: './home.component.html',
                       ~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component HomeComponent.

Resources (screenshots, code snippets etc.)

Hi,

I'm building an Angular app, and I'd like to add in a navbar, but it seems I can't.

These are the exact steps to reproduce the error.

ng new navtest
    routing?      Yes
    stylesheet?   SCSS

cd navtest

npm install git+https://oauth2:MY-AUTH-TOKEN@git.mdbootstrap.com/mdb/angular/mdb5/prd/mdb5-angular-ui-kit-pro-essential

ng add mdb-angular-ui-kit
    import all modules?     Yes
    Roboto?                 Yes
    browser animations?     Yes
    Font Awesome?           Yes
    charts?                 Yes

Then for my app.component files, I paste this example:

https://mdbootstrap.com/previews/docs/latest/html/navigation/intro-fixed-transparent.html

app.component.html

<header class="h-100">
<mdb-navbar SideClass="navbar fixed-top navbar-expand-lg navbar-dark scrolling-navbar intro-fixed-nav" [containerInside]="false">
  <mdb-navbar-brand>
    <a class="logo navbar-brand" href="#">
      <strong>Navbar</strong>
    </a>
  </mdb-navbar-brand>
  <links>
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active waves-light" mdbWavesEffect>
        <a class="nav-link">Home
          <span class="sr-only">(current)</span>
        </a>
      </li>
      <li class="nav-item waves-light" mdbWavesEffect>
        <a class="nav-link">Link</a>
      </li>
      <li class="nav-item waves-light" mdbWavesEffect>
        <a class="nav-link">Profile</a>
      </li>
    </ul>
  </links>
</mdb-navbar>
<!-- Main -->
<div class="view intro-2">
  <div class="full-bg-img">
    <div class="mask rgba-purple-light flex-center">
      <div class="container text-center white-text wow fadeInUp">
        <h2>This Navbar is fixed and transparent</h2>
        <br>
        <h5>It will always stay visible on the top, even when you scroll down</h5>
        <p>Navbar's background will switch from transparent to solid color while scrolling down</p>
        <br>
        <p>Full page intro with background image will be always displayed in full screen mode, regardless of device </p>
      </div>
    </div>
  </div>
</div>
<!-- /.Main -->

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

app.component.scss

.view {
background: url("https://mdbootstrap.com/img/Photos/Others/img (40).webp")no-repeat center center;
background-size: cover;
height: 100vh;

}

.navbar { background-color: transparent; }

.top-nav-collapse { background-color: #4285F4; }

@media only screen and (max-width: 768px) { .navbar { background-color: #4285F4; } }


Rafał Seifert staff answered 7 months ago


It looks like you are on MDB5 Angular version while using MDB4 Angular docs. Please refer to current docs : https://mdbootstrap.com/docs/angular/navigation/navbar/


Ryannnnn priority answered 7 months ago


I found that your team updated the MDB4 code into MDB5 already!

https://mdbootstrap.com/docs/angular/navigation/headers/

it's the final example on that page, titled "Animated navbar"

thanks again!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB5 5.0.0
  • Device: Mac
  • Browser: Chrome
  • OS: 13.5.2
  • Provided sample code: No
  • Provided link: Yes