Topic: angular pro navbar collapse function
I'm using the latest version of angular pro. What is the name of the function being called on navbar hamburger that toggles the collapse and expand animation?
I've read the documentation for a responsive navbar collapse and it won't work in my situation as I am just doing a single page scroll and not using router. I can't locate the function being called to toggle the nabar collapse/expand state but can simply call if from the nav-links if you provide the function name.
thanks!
Nelson
Damian Gemza staff answered 6 years ago
<!--Navbar--> <mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark fixed-top scrolling-navbar"> <mdb-navbar-brand> <a class="logo navbar-brand waves-light" mdbWavesEffect href="#"><strong>MDB</strong></a> </mdb-navbar-brand> <links> <ul class="navbar-nav mr-auto"> <li class="nav-item active waves-light"mdbWavesEffect> <a class="nav-link"href="#section1" #hide (click)="hideNav()">Home <spanclass="sr-only">(current)</span></a> </li> <li class="nav-item waves-light"mdbWavesEffect> <a class="nav-link"href="#section1" #hide (click)="hideNav()">Link</a> </li> <li class="nav-item waves-light"mdbWavesEffect> <a class="nav-link" href="#section1" #hide (click)="hideNav()">Profile</a> </li> </ul> <form class="form-inline waves-light"mdbWavesEffect> <div class="md-form mt-0"> <input class="form-control mr-sm-2"type="text"placeholder="Search"aria-label="Search"> </div> </form> </links> </mdb-navbar>
@ViewChild(NavbarComponent) link: NavbarComponent; hideNav() { this.link.hide(); }
nelsfoltz pro commented 6 years ago
Thanks for the quick response Damian! What do I need to import into the navbar component so that it recognizes "this.link.hide"? That seems to be throwing the error shown below. ERROR in src/app/navbar/navbar.component.ts(11,15): error TS2339: Property 'hide' does not existon type 'NavbarComponent'.Arkadiusz Idzikowski staff answered 6 years ago
import { NavbarComponent } from 'ng-uikit-pro-standard';
@ViewChild('link') link: NavbarComponent;
<mdb-navbar #link SideClass="navbar navbar-1 navbar-light grey lighten-5 fixed-top scrolling-navbar" [containerInside]="false">
nelsfoltz pro answered 6 years ago
View_NavbarComponent_0 | @ | NavbarComponent.html:18 | |
proxyClass | @ | compiler.js:10058 | |
push../node_modules/@angular/core/fesm5/core.js.DebugContext_.logError | @ | core.js:11105 | |
push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError | @ | core.js:1670 | |
dispatchEvent | @ | core.js:7513 | |
(anonymous) | @ | core.js:7953 | |
(anonymous) | @ | platform-browser.js:1140 | |
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask | @ | zone.js:421 | |
onInvokeTask | @ | core.js:3748 | |
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask | @ | zone.js:420 | |
push../node_modules/zone.js/dist/zone.js.Zone.runTask | @ | zone.js:188 | |
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask | @ | zone.js:496 | |
invokeTask | @ | zone.js:1540 | |
globalZoneAwareCallback |
Damian Gemza staff answered 6 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No