CuppaLabs / angular2-multiselect-dropdown

Angular 2 Dropdown Multiselect
https://cuppalabs.github.io/angular2-multiselect-dropdown
MIT License
292 stars 257 forks source link

Can't bind to 'data' since it isn't a known property of 'angular2-multiselect'. #216

Closed giovannidias1 closed 6 years ago

giovannidias1 commented 6 years ago

this error only appears when I try to put the component in HTML

Uncaught Error: Template parse errors: Can't bind to 'data' since it isn't a known property of 'angular2-multiselect'.

  1. If 'angular2-multiselect' is an Angular component and it has 'data' input, then verify that it is part of this module.
  2. If 'angular2-multiselect' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
  3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (""col">

    <angular2-multiselect [ERROR ->][(data)]="dropdownList" [(ngModel)]="selectedItems" [settings]="dropdownSettings" (onSelect)="onItemS"): ng:///PlanModule/CreatePLanComponent.html@54:46 Can't bind to 'settings' since it isn't a known property of 'angular2-multiselect'.

  4. If 'angular2-multiselect' is an Angular component and it has 'settings' input, then verify that it is part of this module.
  5. If 'angular2-multiselect' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
  6. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" <angular2-multiselect [(data)]="dropdownList" [(ngModel)]="selectedItems" [ERROR ->][settings]="dropdownSettings" (onSelect)="onItemSelect($event)" (onDeSelect)"): ng:///PlanModule/CreatePLanComponent.html@54:98 'angular2-multiselect' is not a known element:
  7. If 'angular2-multiselect' is an Angular component, then verify that it is part of this module.
  8. If 'angular2-multiselect' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("

    [ERROR ->]<angular2-multiselect [(data)]="dropdownList" [(ngModel)]="selectedItems" [settings]="dropdownSetting"): ng:///PlanModule/CreatePLanComponent.html@54:24 at syntaxError (compiler.js:485) [] at TemplateParser.parse (compiler.js:24668) [] at JitCompiler._parseTemplate (compiler.js:34621) [] at JitCompiler._compileTemplate (compiler.js:34596) [] at eval (compiler.js:34497) [] at Set.forEach () [] at JitCompiler._compileComponents (compiler.js:34497) [] at eval (compiler.js:34367) [] at Object.then (compiler.js:474) [] at JitCompiler._compileModuleAndComponents (compiler.js:34366) [] at JitCompiler.compileModuleAsync (compiler.js:34260) [] at CompilerImpl.compileModuleAsync (platform-browser-dynamic.js:239) [] at PlatformRef.bootstrapModule (core.js:5567) [] at eval (webpack-internal:///./src/main.ts:10) []

CuppaLabs commented 6 years ago

You have syntax error. data should be [data] and not [(data)]

giovannidias1 commented 6 years ago

I used the example that is in the documentation


<angular2-multiselect [data]="dropdownList" [(ngModel)]="selectedItems" 
                                    [settings]="dropdownSettings" 
                          (onSelect)="onItemSelect($event)" 
                          (onDeSelect)="OnItemDeSelect($event)"
                          (onSelectAll)="onSelectAll($event)"
                          (onDeSelectAll)="onDeSelectAll($event)"></angular2-multiselect>
CuppaLabs commented 6 years ago

But see the error you are getting. This is not a bug with component. Please implement again.

giovannidias1 commented 6 years ago

I tried several times, updated the angular, typescript and CLI and the error persists if i remove [data] and [(ngModel)] [settings] it shows the following error:

Uncaught Error: Template parse errors: 'angular2-multiselect' is not a known element:

  1. If 'angular2-multiselect' is an Angular component, then verify that it is part of this module.
  2. If 'angular2-multiselect' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
                    [ERROR ->]<angular2-multiselect  
                      (onSelect)="onItemSelect($event)" 
          "): ng:///PlanModule/CreatePLanComponent.html@54:24

    at syntaxError (compiler.js:485) [] at TemplateParser.parse (compiler.js:24668) [] at JitCompiler._parseTemplate (compiler.js:34621) [] at JitCompiler._compileTemplate (compiler.js:34596) [] at eval (compiler.js:34497) [] at Set.forEach () [] at JitCompiler._compileComponents (compiler.js:34497) [] at eval (compiler.js:34367) [] at Object.then (compiler.js:474) [] at JitCompiler._compileModuleAndComponents (compiler.js:34366) [] at JitCompiler.compileModuleAsync (compiler.js:34260) [] at CompilerImpl.compileModuleAsync (platform-browser-dynamic.js:239) [] at PlatformRef.bootstrapModule (core.js:5567) [] at eval (main.ts:11) []

my app.module

import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown/angular2-multiselect-dropdown';
import { YearPickerComponent } from './year-picker/year-picker.component';
import { PlanModule } from './plan/plan.module';
import { ClientMasterModule } from './client-master/client-master.module';
import { RestService } from './rest.service';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';

import { AppRoutingModule } from './app.routing';
import { ComponentsModule } from './components/components.module';

import { AppComponent } from './app.component';

import { DashboardComponent } from './dashboard/dashboard.component';
import { UserProfileComponent } from './user-profile/user-profile.component';
import { TableListComponent } from './table-list/table-list.component';
import { TypographyComponent } from './typography/typography.component';
import { IconsComponent } from './icons/icons.component';
import { MapsComponent } from './maps/maps.component';
import { NotificationsComponent } from './notifications/notifications.component';
import { UpgradeComponent } from './upgrade/upgrade.component';
import { CommonFunctionsService } from './common-functions.service';
import * as $ from 'jquery';
import { DataTablesModule } from 'angular-datatables';
import { Ng2SmartTableModule } from 'ng2-smart-table';
import { Ng2TableModule } from 'ng2-table/ng2-table';
import { PaginationModule } from "ng2-bootstrap/pagination";

@NgModule({
  declarations: [
    AppComponent,
    DashboardComponent,
    UserProfileComponent,
    TableListComponent,
    TypographyComponent,
    IconsComponent,
    MapsComponent,
    NotificationsComponent,
    UpgradeComponent,
    YearPickerComponent,

  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    ComponentsModule,
    DataTablesModule,
    Ng2SmartTableModule,
    Ng2TableModule,
    RouterModule,
    AppRoutingModule,
    ClientMasterModule,
    PaginationModule.forRoot(),
    AngularMultiSelectModule,
    PlanModule
  ],
  providers: [RestService, CommonFunctionsService],
  bootstrap: [AppComponent]
})
export class AppModule { }

my package.json

{
  "name": "md-free-angular-cli",
  "version": "1.4.2",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "node app.js",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "ng build --prod"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/build-optimizer": "^0.4.0",
    "@angular-devkit/core": "^0.4.2",
    "@angular-devkit/schematics": "0.0.34",
    "@angular/animations": "^5.2.0",
    "@angular/cdk": "^5.0.4",
    "@angular/cli": "^1.7.1",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/material": "^5.0.4",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/platform-server": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@firebase/webchannel-wrapper": "0.2.6",
    "@ngui/map": "^0.20.1",
    "@types/bootstrap": "3.3.32",
    "@types/datatables.net": "^1.10.8",
    "@types/googlemaps": "3.26.14",
    "@types/jquery": "^3.3.1",
    "angular-datatables": "^5.0.0",
    "angular2-infinite-scroll": "^0.3.5",
    "angular2-multiselect-dropdown": "^2.6.0",
    "angular2-sails": "^0.2.8",
    "angularfire2": "^5.0.0-rc.6",
    "arrive": "2.3.1",
    "bootstrap": "3.3.5",
    "bootstrap-material-design": "^4.1.1",
    "bootstrap-notify": "3.1.3",
    "chartist": "0.9.4",
    "classlist.js": "1.1.20150312",
    "core-js": "2.4.1",
    "datatables.net": "^1.10.16",
    "datatables.net-dt": "^1.10.16",
    "enhanced-resolve": "^3.3.0",
    "express": "^4.15.3",
    "firebase": "^4.9.1",
    "gulp-sass": "3.1.0",
    "jquery": "^1.12.4",
    "js-beautify": "^1.7.5",
    "jspdf": "^1.3.5",
    "moment": "2.18.1",
    "ng-socket-io": "^0.2.4",
    "ng2-bootstrap": "^1.6.3",
    "ng2-currency-mask": "^5.3.1",
    "ng2-scroll-to-el": "^1.1.0",
    "ng2-smart-table": "^1.2.2",
    "ng2-table": "^1.3.2",
    "ngx-bootstrap": "^2.0.2",
    "ngx-clipboard": "^9.1.3",
    "node-sass": "^4.7.2",
    "perfect-scrollbar": "^1.3.0",
    "pretty": "^2.0.0",
    "rxjs": "^5.5.6",
    "typescript": "^2.6.2",
    "vanilla-ripplejs": "^1.0.3",
    "web-animations-js": "^2.3.1",
    "zone.js": "0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "^1.7.1",
    "@angular/compiler-cli": "^5.2.0"
  }
}
dsmileym4 commented 6 years ago

I ran across this same issue when running unit tests.

dsmileym4 commented 6 years ago

Resolved my issue by updating the test spec to ignore errors: https://stackoverflow.com/questions/44365392/how-to-ignore-an-html-tag-of-a-3rd-party-component-in-an-angular4-unit-test

exodinn commented 6 years ago

Still an issue, I have the same problem. Anyone already found solution?

osamasaeed commented 5 years ago

I am also working with angular 5 . But my issue is resolved. I just import NO_ERRORS_SCHEMA and include in same module where angular2-multiselect-dropdown module included @NgModule. here is my module

import { NgModule ,NO_ERRORS_SCHEMA} from '@angular/core';
import { FormsModule } from '@angular/forms';

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    AngularMultiSelectModule,
  ],
  schemas:[NO_ERRORS_SCHEMA], 
})
export class SettingsModule { }
.  .  .
andriybilas commented 5 years ago

the same issue I have.... I've trried example from demo. Unfortunately doesn't work...

ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'settings' since it isn't a known property of 'angular2-multiselect'.

  1. If 'angular2-multiselect' is an Angular component and it has 'settings' input, then verify that it is part of this module.
  2. If 'angular2-multiselect' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
  3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
    <angular2-multiselect [(ngModel)]="projectsToReport" [ERROR ->][settings]="dropdownSettings">
    "): ng:///AdminModule/ReportsComponent.html@76:67 'angular2-multiselect' is not a known element:
  4. If 'angular2-multiselect' is an Angular component, then verify that it is part of this module.
  5. If 'angular2-multiselect' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
    [ERROR ->]
  6. If 'angular2-multiselect' is an Angular component and it has 'settings' input, then verify that it is part of this module.
  7. If 'angular2-multiselect' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
  8. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
    <angular2-multiselect [(ngModel)]="projectsToReport" [ERROR ->][settings]="dropdownSettings">
    "): ng:///AdminModule/ReportsComponent.html@76:67 'angular2-multiselect' is not a known element:
  9. If 'angular2-multiselect' is an Angular component, then verify that it is part of this module.
  10. If 'angular2-multiselect' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
    [ERROR ->] ) at JitCompiler.push../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._compileComponents (compiler.js:34477) at compiler.js:34347 at Object.then (compiler.js:474) at JitCompiler.push../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:34346) at syntaxError (compiler.js:485) at TemplateParser.push../node_modules/@angular/compiler/esm5/compiler.js.TemplateParser.parse (compiler.js:24661) at JitCompiler.push../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._parseTemplate (compiler.js:34601) at JitCompiler.push../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._compileTemplate (compiler.js:34576) at compiler.js:34477 at Set.forEach () at JitCompiler.push../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._compileComponents (compiler.js:34477) at compiler.js:34347 at Object.then (compiler.js:474) at JitCompiler.push../node_modules/@angular/compiler/esm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:34346) at resolvePromise (zone.js:821) at resolvePromise (zone.js:785) at zone.js:870 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421) at Object.onInvokeTask (core.js:4724) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188) at drainMicroTaskQueue (zone.js:594)
srdjan2002ca commented 5 years ago

I had this error for a long time before I realized i was using: <angular2-multiselect-dropdown .... > instead of: <angular2-multiselect ....>

gopalkrish23 commented 5 years ago

I imported AngularMultiSelectModule in the same module where i need to use the component. It fixed the error.

ashishc commented 4 years ago

Had same issue so instead of importing module I've imported following multiselect modular dependency separately and it worked-

imports: [ CommonModule,FormsModule ], declarations: [AngularMultiSelect, ClickOutsideDirective, ListFilterPipe],

My solution looks like -

import {CommonModule} from "@angular/common"; import {FormsModule} from "@angular/forms"; import {ClickOutsideDirective} from "angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/clickOutside"; import {ListFilterPipe} from "angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/list-filter"; import {AngularMultiSelect} from "angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component";

@NgModule({ imports: [ NbCardModule, ThemeModule, NbSelectModule, CommonModule,FormsModule ], declarations: [ DashboardComponent,AngularMultiSelect, ClickOutsideDirective, ListFilterPipe ], }) export class DashboardModule { }

OrbitalJeffL commented 3 years ago

This bug is still present. Please fix.