angular-select2 icon indicating copy to clipboard operation
angular-select2 copied to clipboard

Can't bind to 'settings' since it isn't a known property of 'select2'.

Open nicolascamilo opened this issue 7 years ago • 7 comments

Is this actually working? What I'm doing wrong?

<select2 *ngIf="active" [options]="options" [settings]="{ placeholder: value }" [(ngModel)]="selectedValue" name="selectedValue"></select2>

nicolascamilo avatar Jun 18 '18 01:06 nicolascamilo

It seems you need to import the component into your module.

godbasin avatar Jun 18 '18 02:06 godbasin

#28

godbasin avatar Jun 18 '18 02:06 godbasin

It's already imported. Anything else I could be missing?

nicolascamilo avatar Jun 18 '18 02:06 nicolascamilo

May be you can provide a demo code? Or you can checkout the demo on master branch.

godbasin avatar Jun 18 '18 07:06 godbasin

Did you get an error like this?

ERROR in ./node_modules/angular-select2-component/index.ts
Module build failed: Error: /home/<user>/<projects-dir>/<project-name>/node_modules/angular-select2-component/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

I got that error in my case even if I already include the file in tsconfig.json

ajcastro avatar Sep 13 '18 12:09 ajcastro

Please leave your tsconfig.json here. Thanks.

godbasin avatar Nov 30 '18 06:11 godbasin

I have the same issue in Angular 6:

ERROR in ./node_modules/angular-select2-component/index.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):Error: C:\dev\frontend\node_modules\angular-select2-component\index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in
published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
    at AngularCompilerPlugin.getCompiledFile (C:\dev\frontend\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:753:23)
    at plugin.done.then (C:\dev\frontend\node_modules\@ngtools\webpack\src\loader.js:41:31)
    at 
    at process._tickCallback (internal/process/next_tick.js:188:7)
i 「wdm」: Failed to compile.

This is current tsconfi.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

After I included the file:

...
 "lib": [
      "es2017",
      "dom"
    ]
"include": [
    "node_modules/angular-select2-component/index.ts"
  ]

I get following error:

ERROR in No NgModule metadata found for 'AppModule'.

So i included the files as:

 "include": [
    "node_modules/angular-select2-component"
  ],
  "files": [
    "src/app/app.module.ts"
  ]

But ran into this:

ERROR in Could not resolve module @angular/core
i 「wdm」: Failed to compile.

ck4957 avatar Dec 04 '18 19:12 ck4957