2017-02-17 28 views
1

我在我的angular2應用程序中使用ngprime。我使用DataTable我的表視圖,並能進行排序,篩選,但是當我嘗試使用Crud功能或ContextMenu我得到錯誤...問題與contextMenu和CRUD表ngPrime angular2

ngPrime docs使用我的AppModule

import {SplitButtonModule} from "primeng/components/splitbutton/splitbutton"; 
@NgModule({ 
    declarations: [ 
    AppComponent, 
    CarsComponent, 
    ModsComponent 
    ], 
    imports: [ 
    BrowserModule, FormsModule, 
    HttpModule, routing, 
    DataTableModule, SharedModule, 
    ButtonModule, DropdownModule, 
    TieredMenuModule, SplitButtonModule 
    ], 
    providers: [ 
    AppConfig, CarsService, 
    { provide: APP_INITIALIZER, useFactory: (config: AppConfig) =>() => config.load(), deps: [AppConfig], multi: true } 
    ], 
    bootstrap: [AppComponent] 
}) 
export class AppModule { } 

示例代碼中發現Here

錯誤......

Unhandled Promise rejection: Template parse errors: Can't bind to 'model' since it isn't a known property of 'p-contextMenu'. 
1. If 'p-contextMenu' is an Angular component and it has 'model' input, then verify that it is part of this module. 
2. If 'p-contextMenu' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. 
Unhandled Promise rejection: Template parse errors: Can't bind to 'visible' since it isn't a known property of 'p-dialog'. 
1. If 'p-dialog' is an Angular component and it has 'visible' input, then verify that it is part of this module. 
2. If 'p-dialog' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. 

我在這裏錯過任何進口嗎?

回答

2

您必須在您的模塊導入中從primeng/primeng導入ContextMenuModuleDialogModule

+0

謝謝,它的工作。 – user1653027

+0

有無論如何,我們可以改變上下文菜單和selectionMode選項'[p-dataTable [value] =「users」selectionMode =「single」[(selection)] =「selectedUser」[contextMenu] =「cm」>'for [hasPermission ] =「'管理員」「selectionMode =」倍數「和其他人爲單? – user1653027