Saurabh Singh Rajput
Saurabh Singh Rajput

Reputation: 704

I am getting error while implementing ngx-Spinner 8.0.3

I want a spinner loader to be implemented in my app. I am following the process given here [ https://www.npmjs.com/package/ngx-spinner ] I installed and Saved it.

And When I am importing and adding it to "imports", I am getting the following error.

Uncaught TypeError: Object(...) is not a function at ngx-spinner.js:208 at Module../node_modules/ngx-spinner/fesm5/ngx-spinner.js (ngxspinner.js:210) at webpack_require (bootstrap:78) at Module../src/app/app.module.ts (app.component.ts:23) at webpack_require (bootstrap:78) at Module../src/main.ts (main.ts:1) at webpack_require (bootstrap:78) at Object.0 (main.ts:12) at webpack_require (bootstrap:78) at checkDeferredModules (bootstrap:45)

npm i ngx-spinner
npm install ngx-spinner --save


aap.module.ts

    import { NgxSpinnerModule } from "ngx-spinner";

    imports: [
        // ...
        NgxSpinnerModule
    ]

I am not getting how to get out of this error If anyone can please help me.

Upvotes: 2

Views: 13819

Answers (2)

Mohammadkhalil
Mohammadkhalil

Reputation: 11

First: When you got this error, first you need to remove the imports of Ngx from app.component.ts and from all other components aswell.

Second: Remove your Node Module folder and use the command npm install.

In my case, I'm using angular 11 .

Upvotes: 1

Archit Garg
Archit Garg

Reputation: 3257

This must be a version mismatch between your angular version and the version of ngx-spinner. Please make sure if you are on angular 7 then you must install 7.* version of this library. Similarly if on angular 8 then, use 8.* version of ngx-spinner.

Issue on github for further help - https://github.com/Napster2210/ngx-spinner/issues/100

Upvotes: 5

Related Questions