-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorder.service.ts
More file actions
35 lines (31 loc) · 813 Bytes
/
order.service.ts
File metadata and controls
35 lines (31 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// order.service.ts
import { Injectable } from '@angular/core';
import { Order } from './order.model';
import { OrderTable } from './order-table.model';
@Injectable({
providedIn: 'root'
})
export class OrderService {
constructor() { }
getOrderTable(): OrderTable {
const orders: Order[] = [
{date: '2000-01-01', product: 'Apples', value: 1000},
{date: '2000-02-01', product: 'Apples', value: 2000},
{date: '2000-01-01', product: 'Oranges', value: 10000}
];
return {
headers: ['2000-01-01', '2000-02-01'],
rowLabels: ['Apples', 'Oranges'],
orders: orders,
orderMap: {
'2000-01-01': {
'Apples': orders[0],
'Oranges': orders[2]
},
'2000-02-01': {
'Apples': orders[1]
}
}
};
}
}