Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't find DeviceDetectorModule In ngx-device-detector

Tags:

angular

To install this library, run:

$ npm install ngx-device-detector --save

package.json

"ngx-device-detector": "^2.0.6",

Usage: Import DeviceDetectorModule in your app.module.ts

  import { NgModule } from '@angular/core';
  import { DeviceDetectorModule } from 'ngx-device-detector';
  ...
  @NgModule({
    declarations: [
      ...
      LoginComponent,
      SignupComponent
      ...
    ],
    imports: [
      CommonModule,
      FormsModule,
      DeviceDetectorModule.forRoot()
    ],
    providers:[
      AuthService
    ]
    ...
  })

But I have an error on this line:

import { DeviceDetectorModule } from 'ngx-device-detector';

error:

TS2305: Module '"../../node_modules/ngx-device-detector/ngs-device-detector"' has no exported member 'Device Detector Module'.

1 Answers

The answer is here:

Module '"../../node_modules/ngx-device-detector/ngs-device-detector"' has no exported member 'Device Detector Module'.

It means that the library does not have the DeviceDetectorModule. You're probably using old documentation.

In the library docs it states that now you can use the service directly, without the module:

import { DeviceDetectorService } from 'ngx-device-detector';

So there is no need to use the module you're trying to use.

like image 54
kvetis Avatar answered Oct 18 '25 07:10

kvetis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!