import { ChangeDetectionStrategy , Component } from '@angular/core' ; import { WireType , WireV2Service } from '../../wire-v2.service' ; @ Component ( { selector : 'm-wireCreator__form' , changeDetection : ChangeDetectionStrategy . OnPush , templateUrl : 'form.component.html' , styleUrls : [ 'form.component.ng.scss' ] , } ) export class WireCreatorFormComponent { param service constructor ( public service ) { } param amount setAmount ( amount ) { amount = amount . trim ( ) ; if ( amount . slice ( - 1 ) === '.' ) { return ; } const numericAmount = parseFloat ( amount . replace ( /,/g , '' ) || '0' ) ; if ( isNaN ( numericAmount ) ) { return ; } this . service . setAmount ( numericAmount ) ; } param { WireType } the returns { void } public setType ( type ) { if ( type === 'eth' || type === 'btc' ) { this . service . amount$ . next ( 0.01 ) ; } else { this . service . amount$ . next ( 1 ) ; } this . service . setType ( type ) ; } }