ng2-select icon indicating copy to clipboard operation
ng2-select copied to clipboard

Can't bind to 'items' since it isn't a known property of 'ng-select'.

Open k1ng440 opened this issue 9 years ago • 12 comments

Hello, I am using angular 2.0.1 and have imported the module.

can someone help? thanks

k1ng440 avatar Oct 07 '16 21:10 k1ng440

I've faced with the same problem. After reading some other issues, I made some corrections in my code:

  1. Import SelectModule to the your module:
import { SelectModule } from 'ng2-select';

@NgModule({
  imports: [ SelectModule ]
})
  1. Change "initData" property to "active" property - if you need it: <ng-select [active]="yourActiveItems" ...></ng-select>
  2. Remove SELECT_DIRECTIVES at all - you should use SelectModule now (see 1).

aleksfes avatar Oct 11 '16 11:10 aleksfes

I'm having the same exact issue as well. Does anyone have a working sample angular 2 project with this?

shima20 avatar Oct 17 '16 16:10 shima20

@shima20 if you are lazy loading modules. you have to import it on lazy loaded module

k1ng440 avatar Oct 17 '16 16:10 k1ng440

@k1ng440 what exactly do you mean? do you have an example? I don't believe I'm lazy loading.

shima20 avatar Oct 17 '16 16:10 shima20

You have to import the forms module into your component module because [(ngModel)] requires it:

import { FormsModule } from '@angular/forms';

imports: [FormsModule],

hetzbr avatar Nov 30 '16 00:11 hetzbr

I have exactly the same problem. Does anyone have actual working Angular 2 example with this library?

typeofweb avatar Feb 06 '17 22:02 typeofweb

I am also facing same problem. please help anyone...

ArifRathod avatar Apr 23 '17 17:04 ArifRathod

[1]

npm install --save @ng-select/ng-select

[2] app.module.ts - import { NgSelectModule } from '@ng-select/ng-select'; import { FormsModule } from '@angular/forms';

@NgModule({ declarations: [AppComponent], imports: [NgSelectModule, FormsModule], bootstrap: [AppComponent] }) export class AppModule {}

[3] Include in style.scss - @import "~@ng-select/ng-select/themes/default.theme.css"; // ... or @import "~@ng-select/ng-select/themes/material.theme.css";

Reference - https://github.com/ng-select/ng-select

suchetaswabhav avatar Mar 01 '19 07:03 suchetaswabhav

I had the same problem and it was caused by missing dependency (@angular/cdk).

Installed it and the problem was solved.

skodamaAcro avatar Sep 10 '21 23:09 skodamaAcro

Getting this errror node_modules/@ng-select/ng-select/lib/config.service.d.ts:16:21 - error TS2694: Namespace has no exported member 'ɵɵFactoryDeclaration'. 16 static ɵfac: i0.ɵɵFactoryDeclaration<NgSelectConfig, never>;

Can anyone help, please?

anubhav333 avatar Aug 02 '22 06:08 anubhav333

Add imports: [NgSelectModule, FormsModule] on component ...spec.ts

before compiling will import the specific module

beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ InstituicaoComponent ],
      imports: [NgSelectModule, FormsModule]
    })
    .compileComponents();
  }));

lucasmatoscc avatar Aug 02 '22 22:08 lucasmatoscc

I am facing same issue in angular 16, anyone have solution

Shubham161100 avatar Jul 24 '23 08:07 Shubham161100