29 lines
871 B
TypeScript
29 lines
871 B
TypeScript
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
|
import { ActivatedRoute, Params } from '@angular/router';
|
|
import { TokenService } from '@app/_services';
|
|
import { first } from 'rxjs/operators';
|
|
import { Token } from '../../../_models';
|
|
|
|
@Component({
|
|
selector: 'app-token-details',
|
|
templateUrl: './token-details.component.html',
|
|
styleUrls: ['./token-details.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
})
|
|
export class TokenDetailsComponent implements OnInit {
|
|
token: Token;
|
|
|
|
constructor(private route: ActivatedRoute, private tokenService: TokenService) {
|
|
this.route.paramMap.subscribe((params: Params) => {
|
|
this.tokenService
|
|
.getTokenBySymbol(params.get('id'))
|
|
.pipe(first())
|
|
.subscribe((res) => {
|
|
this.token = res;
|
|
});
|
|
});
|
|
}
|
|
|
|
ngOnInit(): void {}
|
|
}
|