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

Created on 7 Oct 2016  路  9Comments  路  Source: valor-software/ng2-select

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

can someone help?
thanks

Most helpful comment

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).

All 9 comments

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).

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

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

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

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

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

imports: [FormsModule],

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

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

[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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cadenei picture Cadenei  路  4Comments

fdu-axiometrics picture fdu-axiometrics  路  5Comments

uzumakinaruto123 picture uzumakinaruto123  路  5Comments

rkralston picture rkralston  路  3Comments

denghuiquan picture denghuiquan  路  3Comments