Alexis Hernandez
7 years ago
6 changed files with 76 additions and 2 deletions
@ -0,0 +1,12 @@ |
|||
<div class="row"> |
|||
<div class="col-xs-4 col-sm-4 col-md-offset-1 col-md-3 col-lg-offset-1 col-lg-3"> |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading">{{'label.totalSupply' | translate}} |
|||
</div> |
|||
<div class="panel-body"> |
|||
<span *ngIf="ticker == null">{{'message.unavailable' | translate}}}}</span> |
|||
<span *ngIf="ticker != null">{{ticker.totalSupply}} {{'label.coinName' | translate}}</span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,25 @@ |
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { TickerComponent } from './ticker.component'; |
|||
|
|||
describe('TickerComponent', () => { |
|||
let component: TickerComponent; |
|||
let fixture: ComponentFixture<TickerComponent>; |
|||
|
|||
beforeEach(async(() => { |
|||
TestBed.configureTestingModule({ |
|||
declarations: [ TickerComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
})); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(TickerComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
@ -0,0 +1,33 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
|
|||
import { TickerService } from '../../services/ticker.service'; |
|||
import { ServerStats } from '../../models/ticker'; |
|||
|
|||
@Component({ |
|||
selector: 'app-ticker', |
|||
templateUrl: './ticker.component.html', |
|||
styleUrls: ['./ticker.component.css'] |
|||
}) |
|||
export class TickerComponent implements OnInit { |
|||
|
|||
ticker: ServerStats; |
|||
|
|||
constructor(private tickerService: TickerService) { } |
|||
|
|||
ngOnInit() { |
|||
this.tickerService |
|||
.get() |
|||
.subscribe( |
|||
response => this.onTickerRetrieved(response), |
|||
response => this.onError(response) |
|||
); |
|||
} |
|||
|
|||
private onTickerRetrieved(ticker: ServerStats) { |
|||
this.ticker = ticker; |
|||
} |
|||
|
|||
private onError(response: any) { |
|||
console.log(response); |
|||
} |
|||
} |
Loading…
Reference in new issue