我目前正在尝试设置一个AngularDart组件,该组件从父组件接收数据并使用它绘制SlickDart网格。问题是它抛出以下错误:
它的代码是:
<div class="row justify-content-center">
<div id="grid" style="width:100%; height:500px;"></div>
</div>
import 'package:angular/angular.dart';
import 'package:angular_components/angular_components.dart';
import 'dart:html';
import 'package:intl/intl.dart';
import 'package:slickdart/slick.dart' as grid;
import 'package:slickdart/src/slick_custom.dart';
import 'package:slickdart/src/slick_editor.dart'; //new SelectListEditor
@Component(
selector: 'slick-grid',
styleUrls: const ['slickGrid_component.css'],
templateUrl: 'slickGrid_component.html',
directives: const [],
)
class SlickGridComponent implements OnInit {
@Input()
Map data;
ngOnInit() {
grid.SlickGrid n=init(data);
n.init();
}
grid.SlickGrid init(passedData){
Element el = querySelector('#grid');
Map opt = {
'explicitInitialization': false,
'multiColumnSort': false,
'frozenColumn': 0,
'frozenRow': 1,
'editable': true
};
List columns = new grid.ColumnList.fromMap(passedData["fields"]);
List gridData = passedData["data"];
grid.SlickGrid sg= new grid.SlickGrid(el, gridData, columns, opt);
return sg;
}
}