question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sidenav - this.collapseButton.sideNav is not a function

See original GitHub issue

Hi,

i imported the sidenav and added the example code from your tutorial into my app.component.html file. After that i get an error:

AppComponent.html:12 ERROR TypeError: this.collapseButton.sideNav is not a function
    at MzSidenavComponent.push../node_modules/ngx-materialize/fesm5/ngx-materialize.js.MzSidenavComponent.initCollapseButton (ngx-materialize.js:4798)
    at MzSidenavComponent.push../node_modules/ngx-materialize/fesm5/ngx-materialize.js.MzSidenavComponent.ngAfterViewInit (ngx-materialize.js:4759)
    at callProviderLifecycles (core.js:18937)
    at callElementProvidersLifecycles (core.js:18911)
    at callLifecycleHooksChildrenFirst (core.js:18901)
    at checkAndUpdateView (core.js:19837)
    at callViewAction (core.js:20069)
    at execComponentViewsAction (core.js:20011)
    at checkAndUpdateView (core.js:19834)
    at callWithDebugContext (core.js:20722)

I don’t know what i’ve done wrong? Can someone help me?

This is my app.module.ts:

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    MzSidenavModule,
    MzButtonModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

This is my angular.json

 "styles": [
              "src/styles.scss",
              "node_modules/materialize-css/dist/css/materialize.min.css",
              "node_modules/@mdi/font/css/materialdesignicons.min.css"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.min.js",
              "node_modules/materialize-css/dist/js/materialize.min.js"
            ]

This is my tsconfig.app.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": [
      "jquery",
      "materialize-css"
    ]
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

And this is my package.json

{
  "name": "reitsport-rheinmain-web-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.0.3",
    "@angular/common": "~7.0.0",
    "@angular/compiler": "~7.0.0",
    "@angular/core": "~7.0.0",
    "@angular/forms": "~7.0.0",
    "@angular/http": "~7.0.0",
    "@angular/platform-browser": "~7.0.0",
    "@angular/platform-browser-dynamic": "~7.0.0",
    "@angular/router": "~7.0.0",
    "@mdi/font": "^3.0.39",
    "core-js": "^2.5.4",
    "materialize-css": "^1.0.0-rc.2",
    "ngx-materialize": "^6.1.3",
    "rxjs": "~6.3.3",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.10.0",
    "@angular/cli": "~7.0.5",
    "@angular/compiler-cli": "~7.0.0",
    "@angular/language-service": "~7.0.0",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.1.6"
  }
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
aetejeidacommented, Dec 3, 2018

You only need to use the version 0.100.2 for MaterializeCss, that work for me.

“materialize-css”: “^1.0.0-rc.2” to “materialize-css”: “^0.100.2”.

1reaction
monochromatiquecommented, Mar 4, 2019

Change sideNav to sidenav

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: $(...).sideNav is not a function - Stack Overflow
I am trying to use Materialize theme to make a side bar in JSF with Spring . And I imported the Materialize's js...
Read more >
Getting "$(...).sideNav is not a function&#38
I want to setup a sidenav as an admin menu when administrative users log in. I added the following to ... sideNav is...
Read more >
react-pro-sidebar - npm
Start using react-pro-sidebar in your project by running `npm i ... A function that enables you to update the sidebar's collapsed state.
Read more >
Materialize CSS SideNav, Working with ... - Free Time Learn
You can add a dropdown to your sidebar by using our collapsible component. ... A function to be called when sideNav is opened...
Read more >
Creating A Simple Collapsible Sidebar with JavaScript (No ...
We'll then go on to use JavaScript to add functionality to our collapse button which carries out the collapse action. HTML Template. <div...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found