2017-10-05 63 views
0

在多個模塊中調用PrimeNg引用是否存在問題?或者我應該在共享模塊中使用它?那裏有最佳做法嗎? 似乎我無法從primeng中導入「p-dataTable」,但我確實已在聲明組件的模塊中使用它。如何正確導入角度模塊?無法弄清楚我丟失了哪一塊。

我越來越指我的HTML validation.component.html錯誤:

errors.ts:42 ERROR Error: Uncaught (in promise): Error: Template parse errors: 
Can't bind to 'value' since it isn't a known property of 'p-dataTable'. 
1. If 'p-dataTable' is an Angular component and it has 'value' input, then verify that it is part of this module. 
2. If 'p-dataTable' 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. (" 
<body> 
    <h3>Validation tabs go here.</h3> 
    <p-dataTable [ERROR ->][value]="validationsList" selectionMode="single" [(selection)]="selectedValidation" dataKey="id" 
    "): ng:///app/validation/[email protected]:17 

我validation.module.ts

import { NgModule } from '@angular/core'; 
import { RouterModule } from '@angular/router'; 
import { SharedModule } from "../shared/shared.module"; 
import { ValidationComponent } from "./validation.component"; 
import { SampleIdsTableComponent } from "./sampleIdsTable.component"; 
import { AllTestsComponent } from "./allTests.component"; 
import { RunStatusComponent } from "./runStatus.component"; 
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; 
import { NglModule } from 'ng-lightning/ng-lightning'; 
import { 
SharedModule as Prime_SharedModule, 
TabMenuModule, AccordionModule, MenuModule, MenubarModule,  SelectButtonModule, 
CalendarModule, InputTextareaModule, DataTableModule, ChartModule, DataGridModule 
} from 'primeng/primeng'; 

@NgModule({ 
imports: [ 
    SharedModule, 
    RouterModule.forChild([ 
     { 
      path: '', 
      component: ValidationComponent, 
      children: [ 
       { 
        path: '', 
        pathMatch: 'full' 
       }, 
       { 
        path: 'samples', 
        component: SampleIdsTableComponent 
       }, 
       { 
        path: 'allTests', 
        component: AllTestsComponent 
       }, 
       { 
        path: 'runStatus', 
        component: RunStatusComponent 
       } 
      ] 

     }, 
     Prime_SharedModule, 
     TabMenuModule, 
     NgbModule.forRoot(), 
     NglModule.forRoot(), 
     AccordionModule, 
     DataTableModule, 
     MenuModule, 
     MenubarModule, 
     SelectButtonModule, 
     CalendarModule, 
     ChartModule, 
     InputTextareaModule, 
     DataGridModule 
    ]) 
], 
declarations: [ 
    ValidationComponent, 
    SampleIdsTableComponent, 
    AllTestsComponent, 
    RunStatusComponent 
], 
providers: [ 
] 
}) 
export class ValidationModule { } 

回答

0

支架!計算括號。我將所有導入添加到RouterModule.forChild([...]),而不是導入數組。