【发布时间】:2018-04-06 07:05:15
【问题描述】:
我正在尝试angular2gridster
所以我已经在一个新的 angular-cli 项目中安装了这个库。
接下来我将它添加到 app.component.html:
<gridster [options]="gridsterOptions" [draggableOptions]="{ handlerClass: 'panel-heading' }">
<gridster-item *ngFor="let widget of widgets"
[(x)]="widget.x" [(y)]="widget.y" [(w)]="widget.w" [(h)]="widget.h">
<!--some content-->
</gridster-item>
</gridster>
最后,这是我的 app.component.ts:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'app';
widgets: Array<any> = [];
gridsterOptions = {
lanes: 5,
direction: 'vertical',
dragAndDrop: true,
resizable: true,
useCSSTransforms: true,
};
}
最后我运行了我的项目,控制台日志中没有错误,但视图中只有一个空白页。
我忘记了一些东西,为什么它不起作用?
【问题讨论】:
标签: javascript angular gridster