2019-01-08 16:17:20 +03:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
import { of as observableOf, Observable } from 'rxjs';
|
2019-01-18 16:25:35 +03:00
|
|
|
import { CountryOrderData } from '../data/country-order';
|
2019-01-08 16:17:20 +03:00
|
|
|
|
|
|
|
|
@Injectable()
|
2019-01-18 16:25:35 +03:00
|
|
|
export class CountryOrderService extends CountryOrderData {
|
2019-01-08 16:17:20 +03:00
|
|
|
|
|
|
|
|
private countriesCategories = [
|
|
|
|
|
'Sofas',
|
|
|
|
|
'Furniture',
|
|
|
|
|
'Lighting',
|
|
|
|
|
'Tables',
|
|
|
|
|
'Textiles',
|
|
|
|
|
];
|
|
|
|
|
private countriesCategoriesLength = this.countriesCategories.length;
|
|
|
|
|
private generateRandomData(nPoints: number): number[] {
|
|
|
|
|
return Array.from(Array(nPoints)).map(() => {
|
|
|
|
|
return Math.round(Math.random() * 20);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCountriesCategories(): Observable<string[]> {
|
|
|
|
|
return observableOf(this.countriesCategories);
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-18 16:25:35 +03:00
|
|
|
getCountriesCategoriesData(country: string): Observable<number[]> {
|
2019-01-08 16:17:20 +03:00
|
|
|
return observableOf(this.generateRandomData(this.countriesCategoriesLength));
|
|
|
|
|
}
|
|
|
|
|
}
|