Search code examples
angularjquery-select2angular6

'ng-select' is not a known element


this is my code: I want to add on my form https://github.com/ng-select/ng-select multi select for tags input.

components.module.ts:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';

import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgSelectModule } from '@ng-select/ng-select';


@NgModule({
  imports: [
    CommonModule,
    HttpClientModule,
    FormsModule,
    ReactiveFormsModule,
    NgSelectModule,
   ]

})

export class ComponentsModule { }

my modaltest.component.html

  <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <label class="control-label">
                        <strong>Gusti:</strong>
                    </label>
               [ERROR] --->             <ng-select [items]="testitems" [hideSelected]="true" multiple="true" bindLabel="text1"></ng-select> 
   </div>

My error is: Can't bind to 'items' since it isn't a known property of 'ng-select' Why?????

Can you help me? Thank's a lot!


Solution

  • You should import the ngselectmodule inside your page.module.ts.