我正在尝试构建一个使用“Kendo UI for Angular 2”控件的演示应用程序,但我似乎只能让 Button 控件工作。所有其他控件要么显示错误,要么根本不显示。我真的可以使用一些帮助,这样我就可以确定该产品是否值得我们启动一个新的长期项目的成本。
在下面的示例中,我使用 Angular 2 来显示他们的按钮和下拉列表。只有按钮有效。请帮我让这个样本工作。我花了太长时间试图弄清楚这一点。谢谢!
package.json(为简洁起见截断)
"dependencies": {
...
"@progress/kendo-angular-buttons": "^0.10.2",
"@progress/kendo-angular-dropdowns": "^0.10.2",
...
systemjs.config.js(为简洁起见截断)
map: {
app: 'app',
'rxjs': 'npm:rxjs',
'@progress': 'npm:@progress',
'@telerik': 'npm:@telerik',
...
},
packages: {
"@progress/kendo-angular-dropdowns": { main: './dist/npm/js/main.js', defaultExtension: 'js' },
"@progress/kendo-angular-buttons": { main: './dist/npm/js/main.js', defaultExtension: 'js' },
'@telerik/kendo-dropdowns-common': { main: './dist/npm/js/main.js', defaultExtension: 'js' },
...
}
app.module.ts
// Application
import { AppComponent } from './app.component';
// Misc Modules
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { NgModule } from '@angular/core';
// Kendo Controls
import { ButtonsModule } from '@progress/kendo-angular-buttons';
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
// Test Pages
import { KButtonComponent } from './components/k.button.component'
import { KDropDownListComponent } from './components/k.dropdownlist.component'
@NgModule({
imports: [
BrowserModule, FormsModule, ReactiveFormsModule, HttpModule, ButtonsModule, DropDownsModule ],
declarations: [ AppComponent, KButtonComponent, KDropDownListComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule { }
app.component.ts
import { Component } from '@angular/core';
// Kendo Controls
import { ButtonsModule } from '@progress/kendo-angular-buttons';
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<button kendoButton (click)="onButtonClick()" [primary]=true>Button!</button> This works!
<kendo-dropdownlist [data]="listItems"></kendo-dropdownlist> This doesn't even display.
`,
styleUrls: [ '../node_modules/@progress/kendo-angular-buttons/dist/npm/css/main.css', '../node_modules/@progress/kendo-angular-dropdowns/dist/npm/css/main.css' ]
})
export class AppComponent {
listItems: Array<string> = ['This', 'is', 'really', 'upsetting'];
onButtonClick() {
alert('The only working Kendo component');
}
}