升级到rc5并使用新版本重新安装primeng之后,我会收到以下错误:
zone.js?1472019041780:484未处理的承诺拒绝:模板解析错误:无法绑定到“图标”,因为它不是已知的“按钮”属性。(“ver”:悬浮,‘ui-状态-焦点’:聚焦,‘ui-状态-禁用’:禁用}“>]icon=”图标“pButton *ngIf="showIcon”(单击)=“onButtonClick($event,in)”ngClass="):Calendar@7:31;Zone:;Task: Promise.then;Value:
我试着删除对日历的所有引用,这样我至少可以启动并运行该应用程序,并发现了另一个问题:
Can't bind to 'rows' since it isn't a known property of 'p-paginator'.
1. If 'p-paginator' is an Angular component and it has 'rows' input, then verify that it is part of this module.
2. If 'p-paginator' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.
(" <ng-content select="header"></ng-content>
</div>
<p-paginator [ERROR ->][rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks" styleClass="ui"): DataTable@6:25
Can't bind to 'first' since it isn't a known property of 'p-paginator'.
1. If 'p-paginator' is an Angular component and it has 'first' input, then verify that it is part of this module.
2. If 'p-paginator' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.
("<ng-content select="header"></ng-content>
</div>受养人:
import { NgModule, ElementRef } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { HttpModule } from '@angular/http';
import { Calendar, DataTable, Column, InputMask } from 'primeng/primeng';发布于 2016-08-25 07:28:35
正如我在上面的注释中所暗示的,RC5存在一个问题,它会产生这个错误。在大多数情况下,只需禁用最小化,或根据构建调整设置,并使用mangle配置uglify:
{ screw_ie8 : true, keep_fnames: true} or use AOT template compilation这个问题的来源和解决方案是Github.com/角/角/议题/10618这个补丁对我没有用,但我希望它能帮助其他开发人员。
发布于 2016-08-24 07:53:01
您需要以xModule的形式导入所有内容。参考见Primaface的博客。
新方法如下:
import {NgModule} from '@angular/core';
import {InputTextModule,DataTableModule,ButtonModule,DialogModule} from 'primeng/primeng';
@NgModule({
imports: [BrowserModule,InputTextModule,DataTableModule,ButtonModule,DialogModule],
declarations: [AppComponent],
bootstrap: [AppComponent],
providers: [CarService]
})
export class AppModule { }编辑:让我自己改正。我使用子模块,只有一个子模块依赖于PrimeNg,所以我认为它足以导入依赖项。事实证明,我必须在我的app.module.ts (我的主模块)中而不是在我的子模块中导入这些模块。可悲的是,我不知道为什么。
我不知道你为什么会得到“意想不到的价值”。你能分享更多关于你的项目的信息吗?
发布于 2016-09-12 21:35:33
我想补充的是,不仅需要导入所有内容,而且在system.config.js中还需要在packageNames中添加@angular/forms。另外,在引导或主要需要更改为:
import {platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);我让DataTable与RC5和primeng1.0.0-beta.14一起工作。
https://stackoverflow.com/questions/39115960
复制相似问题