Angular 4 slim scroll is not working

1.9k Views Asked by At

I'm using Angular 4 slim scroll (https://www.npmjs.com/package/angular4-slimscroll) for my angular 4 project, it's compiling the application successfully but in browser am getting the following error. Can anyone try to help me to find the issue?

Uncaught Error: Unexpected value 'SlimScroll' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation.

my package.json file is here.

{
  "name": "angular4",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/cdk": "^2.0.0-beta.12",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.4.6",
    "@angular/http": "^4.2.4",
    "@angular/material": "^2.0.0-beta.12",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
    "angular4-carousel": "^3.1.8",
    "angular4-slimscroll": "^1.0.5",
    "bootstrap": "^4.0.0-alpha.6",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "ng2-tag-input": "^1.4.1",
    "ng4-geoautocomplete": "^0.1.0",
    "ng4-loading-spinner": "^1.0.27",
    "ngx-carousel": "^1.2.5",
    "ngx-datetime-picker": "^1.1.0",
    "ngx-pagination": "^3.0.3",
    "rxjs": "^5.4.2",
    "sass": "^1.0.0-beta.3",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "^1.5.0",
    "@angular/compiler-cli": "^4.2.4",
    "@angular/language-service": "^4.2.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.2.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.3.3"
  }
}
1

There are 1 best solutions below

0
menredo On

have you added this in app.modules.ts? If You do. Can you add the code off app.modules.ts? In app.modules.ts Yuo have to add in the part of imports:

import {SlimScroll} from 'angular4-slimscroll';

and, In the part of @NgModule:

@NgModule({
  declarations: [
      ...,
 SlimScroll

  ],