Проблема с установкой зависимостей с помощью Stackblitz - PullRequest
0 голосов
/ 08 апреля 2020

Я попытался установить ng-select в моем проекте stackblitz, установив его в разделе зависимостей и вставив импорт в 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 {}

, но я получил ошибку:

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'?

Как я могу это исправить?

1 Ответ

0 голосов
/ 08 апреля 2020

Я думаю, вы хотели установить "@ ng-select / ng-select": https://www.npmjs.com/package/@ng-select / ng-select

"ng-select" - это пакет, который были отменены: https://www.npmjs.com/package/ng-select

Попробуйте установить "@ ng-select / ng-select", а затем просто измените оператор импорта в app.module.ts на:

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