2017-04-05 53 views
-3

編譯之後在瀏覽器中我得到這個問題:我使用角4我的項目,對於範圍滑塊編寫代碼

moduleId should be a string in "Ng2SliderComponent

enter image description here

enter image description here

在編譯時我下面讓錯誤:

Argument of type '{ selector: string; templateUrl: string; directives: typeof SlideAbleDirective[]; changeDetection...' is not assignable to parameter of type 'Component'. Object literal may only specify known properties, and 'directives' does not exist in type 'Component'.

+1

如果您發佈的相關代碼 – Und3rTow

+1

請張貼有意義的代碼 –

+0

我app.module.ts是「進口{} BrowserModule這將是有益@角/平臺的瀏覽器'; 從'@ angular/core'導入{NgModule}; 從'@ angular/forms'導入{FormsModule}; 從'@ angular/http'導入{HttpModule}; 從'./app.component'導入{AppComponent}; 從'./Slider/ng2-slider.component'導入{Ng2SliderComponent}; @NgModule({ 聲明: AppComponent, Ng2SliderComponent, SlideAbleDirective ], 進口: BrowserModule, FormsModule, HTTP模塊 ], 提供商:[], 自舉:[AppComponent] } ) export class AppModule {} – Raja

回答

0

您可能指到一箇舊的角度版本。由於很長時間(NgModule@Component修飾器不再有directives陣列。這已被移至NgModule聲明數組。您應該刪除您有任何指令在@Component,並將其移動到您的NgModule

+0

嗨@pierre,然後它的錯誤就像沒有出口成員slidingbledirectives。 – Raja

+0

你可以看看上面的圖片我已經分享了什麼確切的錯誤,我越來越 – Raja