1

I tried to install ng-select on my stackblitz project installing it in the dependencies section and inserting the import in app.module.ts https://stackblitz.com/edit/angular-ahhsfh?file=src%2Fapp%2Fapp.module.ts&cc=aa

import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { FormsModule } from "@angular/forms";

import { AppComponent } from "./app.component";
import { HelloComponent } from "./hello.component";
import { HeaderComponent } from "./shared/header/header.component";
import { FooterComponent } from "./shared/footer/footer.component";
import { BookComponent } from "./components/book/book.component";
import { BookDetailComponent } from "./components/bookDetail/book.detail.component";
import { HttpClientModule } from "@angular/common/http";
import { FormComponent } from "./shared/form/form.component";
import { AppRoutingModule } from "./app-routing.module";
import { NgxPaginationModule } from "ngx-pagination";
import { Ng2SearchPipeModule } from "ng2-search-filter";
import { CommonModule } from "@angular/common";
import { NgSelectModule } from 'ng-select';



@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    HttpClientModule,
    AppRoutingModule,
    NgxPaginationModule,
    Ng2SearchPipeModule,
    CommonModule,
    NgSelectModule],

  declarations: [
    AppComponent,
    HelloComponent,
    HeaderComponent,
    FooterComponent,
    BookComponent,
    FormComponent,
    BookDetailComponent
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

but I got an error:

Error in src/app/app.module.ts (17:10)
Module '"../../../node_modules/ng-select/ng-select"' has no exported member 'NgSelectModule'. Did you mean 'SelectModule'?

How Can I fix it?

Andy88
  • 647
  • 2
  • 9
  • 21

1 Answers1

1

I think you meant to install "@ng-select/ng-select": https://www.npmjs.com/package/@ng-select/ng-select

"ng-select" is a package that appears to have been abandoned: https://www.npmjs.com/package/ng-select

Try installing "@ng-select/ng-select", then simply change your import statement in app.module.ts to:

import { NgSelectModule } from "@ng-select/ng-select";