Kendo UI + Angular 2 - 包括在项目中的问题

时间:2017-02-23 17:25:46

标签: angular kendo-ui-angular2

只是尝试将最简单的Kendo UI组件包含到我的Angular 2应用程序中(使用Webpack)并遇到问题Can't bind to 'primary' since it isn't a known property of 'button'.

我在AppModule中导入它

import { ButtonsModule } from '@progress/kendo-angular-buttons';

然后

imports: [
    BrowserModule,
    routing,
    FormsModule,
    HttpModule,
    ButtonsModule,
    SharedModule.forRoot(),
    ...

即使在某种vendor.ts文件中注册Webpack也无法改变一件事。文件/模块本身正在加载到应用程序中,所以我知道至少声明了该指令。我看到他们在网站上提供的插件工作得很好,而且我已经包含了所有按钮的依赖关系。

有什么想法吗? Angular v 2.4.8和我使用的按钮指令的版本是0.20.1

1 个答案:

答案 0 :(得分:1)

通过将ButtonsModule模块导入CommonModule来修复,以便将其共享给其他模块。我尝试使用Kendo Button的组件是一个延迟加载的模块,因此它有自己的模块,只导入应用程序的共享/公共模块。

在SharedModule上添加ButtonsModule导入以及导出它修复了我的问题,因为它随后在任何地方共享。