Project

General

Profile

« Previous | Next » 

Revision 57893

Finished the first implementation of the overview page and the country page

View differences:

countries-table.component.ts
1
import { Component, Input, ViewEncapsulation } from '@angular/core';
2
import {CountryOverview} from '../../domain/overview-data';
1
import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core';
2
import { CountryOverview } from '../../domain/overview-data';
3 3

  
4 4
@Component({
5 5
  selector: 'app-countries-table',
......
8 8
  encapsulation: ViewEncapsulation.None
9 9
})
10 10

  
11
export class CountriesTableComponent {
11
export class CountriesTableComponent implements OnChanges {
12 12

  
13 13
  @Input() isPercentage: boolean;
14 14
  @Input() type: string;
......
19 19

  
20 20
  constructor() {}
21 21

  
22
  ngOnChanges() {
23
    this.countries.sort((a, b) => (a['country'] > b['country']) ? 1 : -1);
24
  }
25

  
22 26
  sortBy(field: string) {
23 27

  
24 28
    if (field === this.isSortedBy) {

Also available in: Unified diff