我正在尝试生成由 ajax 加载的网格(来自我的服务器的 JSON)
什么是简单的等待呢?
如何将异步 json 响应绑定到此网格?
下面的代码是我今天的做法(硬编码)
感谢你
import { Component, OnInit } from '@angular/core';
import { HttpService } from 'services/http.service'
@Component({
selector: 'my-analytics',
styleUrls: ['../../../node_modules/@telerik/kendo-theme-default/dist/all.css'],
template: require('./analytics.component.html')
})
export class AnalyticsComponent implements OnInit {
private gridData: any[] = [{
"ProductID": 1,
"ProductName": "Chai",
"UnitPrice": 18.0000,
"Discontinued": false,
"Category": {
"CategoryID": 1,
"CategoryName": "Beverages",
"Description": "Soft drinks, coffees, teas, beers, and ales"
}
}, {
"ProductID": 2,
"ProductName": "Chang",
"UnitPrice": 19.0000,
"Discontinued": false,
"Category": {
"CategoryID": 1,
"CategoryName": "Beverages",
"Description": "Soft drinks, coffees, teas, beers, and ales"
}
}, {
"ProductID": 3,
"ProductName": "Aniseed Syrup",
"UnitPrice": 10.0000,
"Discontinued": false,
"Category": {
"CategoryID": 2,
"CategoryName": "Condiments",
"Description": "Sweet and savory sauces, relishes, spreads, and seasonings"
}
}];
constructor(private http_service: HttpService) { }
ngOnInit() {
}
}